开发者社区> 问答> 正文

Nginx 启动成功,但外网无法访问

阿里云 Ubuntu 14.04.5 nginx/1.4.6 (Ubuntu)

/etc/nginx/nginx.conf

include /etc/nginx/sites-enabled/*;

sites-enabled 下的 default 配置信息我全注释了,另外新加了一个 deploy_xxx 文件

文件配置如下:
/etc/nginx/sites-enabled/deploy_xxx

server {
    listen  80;
    server_name example.com;
    client_max_body_size 3m;

    location / {
        expires      max;
        add_header     Cache-Control public;

        proxy_redirect   off;
        proxy_set_header  Host        $http_host;
        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;

        proxy_pass     http://example.com;
  }
}

域名已经解析到阿里云服务器了,ping example.com 是通的。

检查80端口:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5459/nginx

检查 nginx 运行情况:

root      5459     1  0 12:14 ?        00:00:00 nginx: master process /usr/sbin/nginx
www-data  5462  5459  0 12:14 ?        00:00:00 nginx: worker process
www-data  5463  5459  0 12:14 ?        00:00:00 nginx: worker process
www-data  5464  5459  0 12:14 ?        00:00:00 nginx: worker process
www-data  5465  5459  0 12:14 ?        00:00:00 nginx: worker process
root      5475  5300  0 12:19 pts/2    00:00:00 grep --color=auto nginx

在浏览器中输入:example.com 打不开网页

查看 nginx 日志信息:

/var/log/nginx/error.log
/var/log/nginx/access.log

两个文件里是空的,没有任何信息。说明 nginx 压根就没处理吧。不知道哪里除了问题,求大神解答

展开
收起
hooz 2017-06-10 12:47:25 11823 0
4 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载