缺月挂梧桐 漏断人初静

导航

apache-php

 

 

1、安装apache

https://www.cnblogs.com/lxlb/p/9159056.html

2、安装php

https://www.cnblogs.com/37yan/p/6879404.html

3、配置apache支持php

https://www.cnblogs.com/qiuxiao/p/6815350.html

4、配置apache

<VirtualHost *:80>
ServerName ***.com
DocumentRoot "/data1/php/***"
<Directory "/data1/php/***">
        SetOutputFilter DEFLATE
        Options FollowSymLinks
        AllowOverride ALL
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

 

5、如果有thinkphp,需要在根目录配置.htaccess

<IfModule mod_rewrite.c>
  options +FollowSymlinks
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

 

然后

 Apache的配置文件mod_rewrite.so开启

AllowOverride None改为AllowOverride All 

 

重启apache后即可

 

 

如果用NGINX的话,需要开启fastcgi,配置如下:

server{
        listen 80;
        server_name edu.mazazikaou.com;
        root /data1/www/edu;
        index index.php index.html index.htm;

        location / {
            if ( !-e $request_filename){
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
                }
        }

        location ~ \.php(/|$) {
            fastcgi_pass    127.0.01:9000;
            fastcgi_index   index.php;
            include         fastcgi.conf;
            set $fastcgi_script_name2 $fastcgi_script_name;
            if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {
                set $fastcgi_script_name2 $1;
                set $path_info $2;
                }
            fastcgi_param    PATH_INFO $path_info;
            fastcgi_param    SCRIPT_FILENAME   $document_root$fastcgi_script_name2;
            fastcgi_param    SCRIPT_NAME    $fastcgi_script_name2;
        }
}

 

 

posted on 2018-09-19 11:00  勤劳の洗碗机  阅读(215)  评论(0编辑  收藏  举报