我首先为我的英语道歉而且我无法提供链接。
这是我的情况。
我有nginx
服务器和php-fpm
服务器。
设置完成后,我可以运行http//nginx/info.php
或http//nginx/index.php
其中' http//nginx/
'是在nginx服务器,
和
info.php
和index.php
位于php-fpm
服务器。
问题是,当我浏览http//nginx/website/index.php
时,我发现错误404未找到,当我在php-fpm
服务器中浏览该文件时,它就在那里但是我仍然没有找到404
更改了nginx:nginx
和777
----------------------------------------------- -------------------------------------------------- ----------------------------------。
这是我的nginx
服务器default.conf
upstream php{
server 10.21.35.230:9000;
}
server {
listen 80;
server_name 10.21.35.230;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /var/www/html;
index index.php index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 10.21.35.230:9000;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
#user configuration
tcp_nodelay off;
open_file_cache max=1000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
----------------------------------------------- -------------------------------------------------- ----------------------------------。
这是我的php-fpm
服务器www.conf
文件
; Start a new pool named 'www'.
[nginx]
user = nginx
group = nginx
listen = 10.21.35.230:9000
listen.owner = nginx
listen.group = nginx
listen.mode = 0777
listen.allowed_clients = 10.21.35.228
----------------------------------------------- -------------------------------------------------- ----------------------------------。
答案 0 :(得分:1)
Php-fpm不应该提供静态文件,在配置中它只提供php文件。您需要为定义了root
的静态文件配置一个附加块
类似
location /www {
root <folder path where /www is located>;
try_files $uri =404;
}