nginx和php都装好了,怎么还是无法访问项目目录
http{includemime.types;default_typeapplication/octet-stream;client_max_body_size50m;#...
http {
include mime.types;
default_type application/octet-stream;
client_max_body_size 50m;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name ip地址 localhost;
charset utf-8;
index index.php index.html index.htm;
root /data/webdata/www;
location ~/fyysz{
root html/wap;
index index.html index.htm;
}
location /operation{
index index.php;
if (-e $request_filename) {
break;
}
if (!-e $request_filename) {
#rewrite ^/(.*)$ /index.php/$1 last;
#rewrite ^(.*)$ /index.php/$1 last;
#rewrite ^/(operation|service)$ /index.php/$1 last;
rewrite "/operation" /operation/index.php/$1 last;
break;
}
}
location ~ \.php{
#root /data/webdata/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){
set $real_script_name $1;
set $path_info $2;
}
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
}
} 展开
include mime.types;
default_type application/octet-stream;
client_max_body_size 50m;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name ip地址 localhost;
charset utf-8;
index index.php index.html index.htm;
root /data/webdata/www;
location ~/fyysz{
root html/wap;
index index.html index.htm;
}
location /operation{
index index.php;
if (-e $request_filename) {
break;
}
if (!-e $request_filename) {
#rewrite ^/(.*)$ /index.php/$1 last;
#rewrite ^(.*)$ /index.php/$1 last;
#rewrite ^/(operation|service)$ /index.php/$1 last;
rewrite "/operation" /operation/index.php/$1 last;
break;
}
}
location ~ \.php{
#root /data/webdata/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){
set $real_script_name $1;
set $path_info $2;
}
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
}
} 展开
2019-05-12
展开全部
先访问下ngnix下面得静态文件,看可以访问不,看会不会报错,如果没问题的话,就说nginx配置没问题。
然后测试php文件,访问php程序,看下页面的返回状态码,如果是服务器错误500的话,就说明php配置的有问题,看下nginx的错误日志,是路径没错误啊,还是别的程序,错误日志里面都有会有反馈的,检查下php-fpm启动了么,或者看下程序是不是错了!
可以贴下错误日志帮你分析下
然后测试php文件,访问php程序,看下页面的返回状态码,如果是服务器错误500的话,就说明php配置的有问题,看下nginx的错误日志,是路径没错误啊,还是别的程序,错误日志里面都有会有反馈的,检查下php-fpm启动了么,或者看下程序是不是错了!
可以贴下错误日志帮你分析下
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询