无法连接到fedora linux上的nginx服务器(digitalocean)

时间:2014-11-07 19:34:11

标签: linux nginx fedora

我试图在DigitalOcean的全新fedora盒子上设置nginx。这些是我的步骤

$ yum install nginx
$ systemctl enable nginx
$ systemctl restart nginx

然而,它似乎不起作用。运行systemctl status nginx

时,我得到以下输出
[root@inspiredev ~]# systemctl status nginx -l
nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
   Active: active (running) since Fri 2014-11-07 14:26:33 EST; 1s ago
  Process: 958 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=1/FAILURE)
  Process: 967 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 966 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
 Main PID: 970 (nginx)
   CGroup: /system.slice/nginx.service
           ├─970 nginx: master process /usr/sbin/ngin
           └─971 nginx: worker proces

Nov 07 14:26:33 inspiredev systemd[1]: Starting The nginx HTTP and reverse proxy server...
Nov 07 14:26:33 inspiredev nginx[966]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Nov 07 14:26:33 inspiredev nginx[966]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Nov 07 14:26:33 inspiredev systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
Nov 07 14:26:33 inspiredev systemd[1]: Started The nginx HTTP and reverse proxy server.

我似乎无法弄明白或哪里出错了。如果有人可以提供帮助,那就太好了。

编辑:当我进入盒子的IP地址时,我什么都没有,这就是为什么我觉得某些东西不能正常工作。

1 个答案:

答案 0 :(得分:5)

从systemd日志中,nginx服务似乎正在运行。 (关于未找到的pid文件的警告似乎是许多发行版的特有情况)。

在fedora 19/20(基于systemd)上,使用以下命令打开防火墙:

firewall-cmd --permanent --zone=public --add-service=http 
systemctl restart firewalld.service

或者:

firewall-cmd --permanent --zone=public --add-port=80/tcp 
systemctl restart firewalld.service

第二种版本语法允许您打开任何端口/协议组合。