php - nginx err_connection_refused,任何人都可以帮助我吗?
问题描述
用 php、mysql 等安装了我的旧站点,一切正常,但我的站点无法从我的局域网外部访问。进行了大量更改并为我的 nginx 站点启用和 php7.4 尝试了至少 100 个配置,但没有任何帮助:/。我收到 502 或连接被拒绝错误。在 ubuntu 20.04 上运行
检查这个默认容器:
server {
listen 80;
root /var/www;
index index.html index.php index.htm index.nginx-debian.html;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
#fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
include snippets/fastcgi-php.conf;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
和 php www.conf (都测试过):
...
;listen = /var/run/php/php7.4-fpm.sock
listen = 0.0.0.0:9000
...
网络统计-lntp:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 9194/php-fpm: maste
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1086/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9151/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 795/systemd-resolve
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 900/cupsd
tcp 0 0 127.0.0.1:9050 0.0.0.0:* LISTEN 1038/tor
tcp6 0 0 :::33060 :::* LISTEN 1086/mysqld
tcp6 0 0 ::1:631 :::* LISTEN 900/cupsd
你们有任何提示,我可能会错过吗?
最好的问候和抱歉我的英语不好
解决方案
配置带有错误日志的文件,例如:
server {
error_log /path/server.error.log;
listen 80;
root /var/www;
index index.html index.php index.htm index.nginx-debian.html;
server_name local...
然后,重新启动 nginx 并检查 server.error.log 文件。通过这些更改,您可以了解正在发生的事情,
推荐阅读
- qt - 如何为windeployqt设置qml输出目录
- html - 如何在非活动输入字段中保持文本居中?
- typescript - 获取 Observable 的值
在一个对象 - git - GIT (TFS) 错误:HTTPS 推送上的身份验证失败
- ios - 无法在 IOS 模拟器上安装 ReactNative 应用程序
- react-admin - React-admin:如何从 AppBar 隐藏刷新按钮?
- python - 替换功能是多次替换单词并组合单词。我怎样才能解决这个问题?
- ms-access - 将多列转置为 2 列
- android - RecyclerView 在更改项目的 UI 时重复项目
- python - 关于在 TFLearn 中使用非二进制标签的问题