gpt4 book ai didi

php - Nginx + PHP5-FPM 保持文件 404 未找到

转载 作者:行者123 更新时间:2023-12-04 18:51:33 26 4
gpt4 key购买 nike

请帮我解决这个问题,我对 Nginx 和 Apache 真的很陌生。我在 Nginx 和 Apache 上安装了 web Chevereto。在 Apache 上它可以工作,但在 Nginx 上它不起作用。我尝试了很多答案,但我的配置似乎又出了问题。主页正在工作,我可以上传图像并将图像上传到图像文件夹(如果手动检查)。它不会进入图像预览,而是进入 404 Not Found 页面。

/etc/nginx/sites-available/默认

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name localhost;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /usr/share/nginx/html;
}

location ~ \.htaccess {
deny all;
}
}

/etc/nginx/nginx.conf
user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
worker_connections 768;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

gzip on;
gzip_disable "msie6";

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

/etc/nginx/fastcgi_params
fastcgi_param   QUERY_STRING        $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

fastcgi_param HTTPS $https if_not_empty;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;

最佳答案

根据我的经验,请检查 php-fpm

尝试重新安装php5-fpm,

sudo apt-get install php5-fpm

并尝试重新启动您的 php fpm

service php5-fpm restart

关于php - Nginx + PHP5-FPM 保持文件 404 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32172320/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com