背景
我正在尝试在 Alpine Linux 服务器上启动并运行一个 nginx /php-fpm7 站点。
问题
当我导航到它时没有出现任何错误。证书很好。并且在 /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 中的所有配置
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.com/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 身份运行可以吗?
不确定我还应该检查什么。