亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

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 關注
  • 226 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號