为了账号安全,请及时绑定邮箱和手机立即绑定

nginx err_connection_refused,有人可以帮助我吗?

nginx err_connection_refused,有人可以帮助我吗?

PHP
慕尼黑8549860 2023-11-04 21:03:02
我的旧网站安装了 php、mysql 等,一切正常,但无法从 LAN 外部访问我的网站。做了很多改变,并为我的 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.socklisten = 0.0.0.0:9000...netstat -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    你们有什么提示吗?有什么我可能会错过的吗?致以诚挚的问候,并对我的英语不好表示歉意
查看完整描述

3 回答

?
阿晨1998

TA贡献2037条经验 获得超6个赞

sudo tail -f /var/log/php7.*-fpm.log

ngnix.conf => php-fpm socet?

location ~ \.php$ {

fastcgi_pass unix:/var/run/php7.0-fpm.sock;

include fastcgi_params;

https://saribzhanov.ru/tehno/nastraivaem-rabotu-php-fpm-na-port-ili-na-soket/ 位置 / { ...


location ~ [^/]\.php(/|$) {

    ...


    fastcgi_pass    127.0.0.1:9000;

    fastcgi_index   index.php;

    include         /etc/nginx/fastcgi_params;

}

} 但


netstat -tulpn | 网络统计 握力9000

... /etc/php/7.3/fpm/pool.d/www.conf => 听 = 127.0.0.1:9000


/etc/php/7.3/fpm/pool.d/www.conf => 监听 = /var/run/fastcgi.sock


Listen.allowed_clients = 127.0.0.1 => 取消注释


并在 nginx.conf 位置 / { ...


location ~ [^/]\.php(/|$) {

    ....


    fastcgi_pass    unix:/var/run/php/php7.3-fpm.sock;

    fastcgi_index   index.php;

    include         /etc/nginx/fastcgi_params;

}

} 看一下“fastcgi_pass” nginx.conf 位置 / { fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; //127.0 替换为 php7.*-fpm.sock !看起来 nginx 没有看到你的 php-fpm


查看完整回答
反对 回复 2023-11-04
?
墨色风雨

TA贡献1853条经验 获得超6个赞

配置带有错误日志的文件,例如:


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 文件。通过这些变化,您可以了解正在发生的事情,


查看完整回答
反对 回复 2023-11-04
?
翻阅古今

TA贡献1780条经验 获得超5个赞

看起来 nginx 没有看到你的 php-fpm 所以,在硬盘上查找 php-fpm 并尝试将 pass 作为 fastcgi_pass 放入 nginx.conf 中,使其看起来像: fastcgi_pass    unix:/var/run/php/php7.*-fpm.sock;



查看完整回答
反对 回复 2023-11-04
  • 3 回答
  • 0 关注
  • 96 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信