明明 nginx 都正常的 防火墙也关掉的 依然无法正常访问网站


[root@qyj-os nginx]# ./sbin/nginx -t
nginx: the configuration file /www/wdlinux/nginx-1.8.0/conf/nginx.conf syntax is ok
nginx: configuration file /www/wdlinux/nginx-1.8.0/conf/nginx.conf test is successful
[root@qyj-os nginx]# ./sbin/nginx -s stop
[root@qyj-os nginx]# ./sbin/nginx -s start
nginx: invalid option: "-s start"
[root@qyj-os nginx]# ./sbin/nginx
[root@qyj-os nginx]# ps -ef |grep nginx
root      38144      1  0 23:44 ?        00:00:00 nginx: master process ./sbin/nginx
root      38147  31655  0 23:45 pts/1    00:00:00 grep nginx
[root@qyj-os nginx]# netstat -anp | grep nginx
tcp        0      0 0.0.0.0:8090                0.0.0.0:*                   LISTEN      38144/nginx 
[root@qyj-os nginx]# /etc/init.d/iptables
Usage: iptables {start|stop|reload|restart|condrestart|status|panic|save}
[root@qyj-os nginx]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@qyj-os nginx]#

 worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;


    server {
        listen      8090;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

明明 nginx 都正常的 防火墙也关掉的 为什么 我 连本地 curl 127.0.0.1:8090 都不行 一直卡住 ?

server {... ...}中root 后面为网页文件的存放地址,请先确认目录存在,并有足够的访问权限
检查SElinux是否关闭,命令:getenfroce ,暂时关闭SElinux命令:setenfroce 0

检查SElinux是否关闭,命令:getenforce ,暂时关闭SElinux命令:setenforce 0 刚写反了