【发布时间】:2020-08-09 03:17:47
【问题描述】:
想在nginx下运行php,遇到了一些困难。我快完成了,但是,我有一个错误 502,我不知道为什么。
我有 Nginx 1.18、php 7.4.x 和 fpm。我在:/usr/share/nginx/html/info.php 中创建了一个 php 文件,但是当我使用它时,出现错误 502。这是我为默认 conf 设置的文件:
服务器{
listen 80;
root /usr/share/nginx/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
我在某些情况下看到过这条线,但是当我执行“nginx -t”时它失败了。
包括sn-ps/fastcgi-php.conf;
我仔细看了看,一切都在本地运行,一切正常。我不明白。
【问题讨论】:
标签: php nginx configuration fastcgi