用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.sock
listen = 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
你们有什么暗示吗,我可能会错过吗?
最诚挚的问候和抱歉,我的英语不好
答案 0 :(得分:0)
使用错误日志配置文件,例如:
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文件。 通过这些更改,您可以了解正在发生的事情,
答案 1 :(得分:0)
它看起来像nginx don t see yuor php-fpm so, FIND php-fpm on harddisk and try put the pass into nginx.conf as fastcgi_pass to make it looks like:
fastcgi_pass Unix:/ var / run / php / php7。*-fpm.sock;`
答案 2 :(得分:0)
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;
}
} 但是
... /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