nginx:
与nginx关联配置相对要麻烦一些:
1.user=可用用户;
2. 全局配置: location / {
root xxx/nginx/html;#1
index index.html index.htm index.php;#2
}
3.php文件处理的配置: location ~ ^.+\.php {
root xxx/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
####pathinfo
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
#fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
重启结束
apache:
当用源码安装php编译时需要安装apxs模块,这样php安装好了会在httpd.conf里面生成
LoadModule php5_module /x/modules/libphp5.so
接下来:
找到:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
在后面添加:
AddType application/x-httpd-php .php(使Apcche支持PHP)
AddType application/x-httpd-php-source .php5
添加:DirectoryIndex index.html index.php
修改ServerName为: 127.0.0.1:80或者localhost:80
网友评论