nginx使用php-fpm无法加载/运行。没有错误

问题描述 投票:0回答:1

背景

我正在尝试建立一个nginx / php-fpm7站点并在高山linux服务器上运行。

问题

我导航到它时没有出现错误。证书很好。在/var/log/access.log文件中,我看到一个GET请求到达该站点。但是...我在/etc/nginx/conf.d/default.conf中定义的网站/应用程序没有被加载/触发。应该提示我登录页面。以下是各种工件:

我检查过的内容

nginx正在运行并正在监听。 php-fpm也正在运行并正在监听

mywww:/etc/nginx/conf.d# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      3979/php-fpm.conf)
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      4480/nginx.conf

nginx.conf加载/etc/nginx/conf.d/default.conf中的所有conf

 mywww:/etc/nginx# cat nginx.conf | grep conf.d
    include /etc/nginx/conf.d/*.conf;

default.conf看起来像这样:

server {
        listen 443 ssl;
        root /var/www/mywebapplication/public;
        server_name mywebbapplication.com;

        ssl_certificate /etc/ssl/a/bundle.crt;
        ssl_certificate_key     /etc/ssl/a/thekey.key;
        ssl_protocols   TLSv1 TLSv1.1 TLSv1.2;

        error_log /var/log/nginx/mywebapplication.log notice;
        index login.php;
        allow all;

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

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index login.php;
                include fastcgi_params;
        }
}

登录页面存在:

  mywww:/etc/nginx# ls -lah /var/www/mywebapplication.com/public/login.php
 -rw-r--r--    1 root     root          66 Apr 25  2019 /var/www/mywebapplication.com/public/login.php

Nginx访问日志文件:

198.1.2.1 - - [24/Mar/2020:15:06:25 +0000] "GET / HTTP/1.1" 200 5 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebK│it/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Mobile Safari/537.36" "-"                                                                 │
198.1.2.1 - - [24/Mar/2020:15:06:29 +0000] "GET /login.php HTTP/1.1" 200 5 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Mobile Safari/537.36" "-"                                                        │

正在运行进程的用户/组:

mywww:/var/www/mywebapplication.com/public# ps aux | grep php
 3979 root      0:00 {php-fpm7} php-fpm: master process (/etc/php7/php-fpm.conf)
 3986 nginx     0:00 {php-fpm7} php-fpm: pool www
 3987 nginx     0:00 {php-fpm7} php-fpm: pool www
 4716 root      0:00 vim /etc/init.d/php-fpm7
 4719 root      0:00 grep php

nginx的用户是“ nginx”:

mywww:/etc/nginx# cat /etc/nginx/nginx.conf | grep user   
user nginx nginx;

Nginx主进程可以root身份运行吗?

不确定我还应该检查什么。

php linux nginx cgi
1个回答
0
投票

[查看root中的default.conf。您正在使用文件夹mywebapplication而不是mywebapplication.com。尝试修复该错字,然后重新启动服务器。

© www.soinside.com 2019 - 2024. All rights reserved.