无法启动nginx HTTP和反向代理服务器问题

Man*_*n S 6 proxy fedora nginx

我第一次在 Fedora 24 中停止 nginx 服务器。我使用 apache 服务器进行开发。对于 onlyoffice 集成,我必须安装 nginx 服务器。我使用此命令安装了 nginx 服务器dnf install nginx

\n\n

在启动 nginx 服务器之前,我停止了 apache 并禁用了它,如下所示。

\n\n
systemctl stop httpd\nsystemctl disable httpd\n
Run Code Online (Sandbox Code Playgroud)\n\n

如果我启动 nginx 服务器,sudo service nginx start我会收到以下错误。

\n\n
Redirecting to /bin/systemctl start  nginx.service\nJob for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,我运行systemctl status nginx.service命令来了解问题详细信息,我在终端中得到了以下输出。

\n\n
[root@localhost ~]# systemctl -l status nginx.service\n\xe2\x97\x8f nginx.service - The nginx HTTP and reverse proxy server\n   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)\n   Active: failed (Result: exit-code) since Thu 2016-10-20 01:45:57 IST; 10s ago\n  Process: 10719 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)\n  Process: 10709 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)\n\nOct 20 01:45:57 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...\nOct 20 01:45:57 localhost.localdomain nginx[10719]: nginx: [emerg] no port in upstream "php-fpm" in /etc/nginx/default.d/phpMyAdmin.conf:17\nOct 20 01:45:57 localhost.localdomain nginx[10719]: nginx: configuration file /etc/nginx/nginx.conf test failed\nOct 20 01:45:57 localhost.localdomain systemd[1]: nginx.service: Control process exited, code=exited status=1\nOct 20 01:45:57 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.\nOct 20 01:45:57 localhost.localdomain systemd[1]: nginx.service: Unit entered failed state.\nOct 20 01:45:57 localhost.localdomain systemd[1]: nginx.service: Failed with result \'exit-code\'.\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试了几种方法来修复/etc/nginx/nginx.conf 中的listen 80tolisten 801但没有问题。我也关注了以下网址,但无法解决问题。

\n\n

nginx未启动,无法启动

\n\n

https://serverfault.com/questions/717752/cant-start-nginx-code-exited-status-1-failure

\n\n

/etc/nginx/default.d/phpMyAdmin.conf

\n\n
# phpMyAdmin\n\nlocation = /phpMyAdmin {\n    alias /usr/share/phpMyAdmin/;\n}\n\nlocation /phpMyAdmin/ {\n     root /usr/share;\n     index index.php index.html;\n\n     location ~ ^/phpMyAdmin/(.+\\.php)$\n     {\n         try_files $uri =404;\n         fastcgi_intercept_errors on;\n         include        fastcgi_params;\n         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;\n         fastcgi_pass   php-fpm;  //this is line number 17\n     }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

提前致谢。

\n

小智 6

就我而言,这是因为 80 端口已被占用。

sudo lsof -t -i:80
sudo kill [port in reply]
Run Code Online (Sandbox Code Playgroud)


Man*_*n S 0

按照 @mattdm 建议回答我的问题,我安装了 php-fpm,现在它开始工作了。

sudo dnf install php-fpm
Run Code Online (Sandbox Code Playgroud)