配置nginx遇到的问题

来源:互联网 发布:天津淘宝模特 编辑:程序博客网 时间:2024/05/29 08:34

1、linux的nginx已经启动,当浏览器访问不到

1、使用该执行打开端口文件
vi /etc/sysconfig/iptables

2、复制一行现有内容,将你要打开的端口设置上就行了,这里是打开80端口
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

3、输入:wq保存退出
4、service iptables restart,使设置生效

2、source nginx.conf报错

-bash: worker_processes: command not found
-bash: events: command not found
-bash: worker_connections: command not found
-bash: nginx.conf: line 15: syntax error near unexpected token }'
-bash: nginx.conf: line 15:
}’

这个不用管,只要运行的时候没有报错就行

3、只能访问80,不能访问自己创建虚拟机的81端口

关闭防火墙即可
CentOS防火墙的关闭,关闭其服务即可:
查看CentOS防火墙信息:/etc/init.d/iptables status
关闭CentOS防火墙服务:/etc/init.d/iptables stop


最后想说的。。。最好在vim里面编辑,不要使用editpad去编辑保存,可能会出现编码错误。。。

原创粉丝点击