linux nginx tp5在入口文件添加下列两行,打印错误信息(调试错误)
error_reporting(E_ALL);
ini_set('display_errors', '1');
vi /usr/local/nginx/conf/fastcgi.conf
fastcgi_param PHP_ADMIN_VALUE"open_basedir=$document_root/:/tmp/:/proc/";
改成:
fastcgi_param PHP_ADMIN_VALUE "open_basedir=NULL";
修改nginx.conf /usr/local/nginx/conf/nginx.conf
在server数组中配置:
修改:
server_name 222.222.222.222;
index index.html index.htm index.php;
root /home/wwwroot/you/public;
添加:
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
修改php.ini /usr/local/php/etc/php.ini
open_basedir = 的注释去掉
cgi.fix_pathinfo = 1
allow_url_fopen = on
user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
upload_max_filesize = 100M
memory_limit = 512M
post_max_size = 100M
max_execution_time = 86400
max_input_time = 86400
disable_functions = (去掉 system , exec )
权限
给项目目录权限chmod -Rf 777 项目名称
最后重启
service nginx restart
/etc/init.d/php-fpm restart
service mysql restart
nginx -s reload
多域名设置就在/usr/local/nginx/conf/vhost/域名.conf中配置,不改nginx.conf,配置项同上。