Nginx服务器.php文件未处理抛出404错误

时间:2018-02-04 12:22:27

标签: php nginx centos7 fpm

我的Nginx配置文件位于 default.conf ,我安装的php版本是:PHP 7.1.14 (cli) (built: Jan 31 2018 08:35:35) ( NTS )

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

我的index.php文件位置在:

/testPaymentPanel {
    alias /var/www/epayment/ ;
    index index.php index.html index.htm;
}
来自php-fpm.service的

systemctl 状态:

Active: active (running) since  2018-02-04 15:31:05 +0330; 13min ago

但是当我打开看起来喜欢的网址时  https://www.example.com/testPaymentPanel/ Nginx返回 404

使用命令tail -f /var/log/nginx/access.log/

找到错误日志
GET /testPaymentPanel/ HTTP/1.1" 404 200 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
位于/etc/php-fpm.d/www.conf中的 php-fpm 服务器配置如下:

listen.owner = nginx
listen.group = nginx
isten = /var/run/php-fpm/php-fpm.sock

0 个答案:

没有答案