配置后 nginx 失败 php
nginx failed after configering php
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2020-06-03 21:32:37 UTC; 17s ago
Docs: man:nginx(8)
Process: 3056 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Jun 03 21:32:34 sal systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 03 21:32:37 sal nginx[3056]: nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:62
Jun 03 21:32:37 sal nginx[3056]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 03 21:32:37 sal systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 03 21:32:37 sal systemd[1]: nginx.service: Failed with result 'exit-code'.
Jun 03 21:32:37 sal systemd[1]: Failed to start A high performance web server and a reverse proxy server.
配置文件
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.socket;
# # With php-cgi (or other tcp sockets):
fastcgi_pass 127.0.0.1:9000;
}
明明告诉你,不能重复使用fastcgi_pass。所以。
如果您使用 php 套接字,请这样设置:
}
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php-cgi (or other tcp sockets):
fastcgi_pass 127.0.0.1:9000;
}
或者如果您使用的是 unix 套接字,请将 fastcgi_pass 更改为:
}
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.socket;
}
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2020-06-03 21:32:37 UTC; 17s ago
Docs: man:nginx(8)
Process: 3056 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Jun 03 21:32:34 sal systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 03 21:32:37 sal nginx[3056]: nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:62
Jun 03 21:32:37 sal nginx[3056]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 03 21:32:37 sal systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 03 21:32:37 sal systemd[1]: nginx.service: Failed with result 'exit-code'.
Jun 03 21:32:37 sal systemd[1]: Failed to start A high performance web server and a reverse proxy server.
配置文件
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.socket;
# # With php-cgi (or other tcp sockets):
fastcgi_pass 127.0.0.1:9000;
}
明明告诉你,不能重复使用fastcgi_pass。所以。
如果您使用 php 套接字,请这样设置:
}
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php-cgi (or other tcp sockets):
fastcgi_pass 127.0.0.1:9000;
}
或者如果您使用的是 unix 套接字,请将 fastcgi_pass 更改为:
}
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.socket;
}