ITPub博客

首页 > > > centos7中部署的项目,可以使用ip访问,域名无法访问

centos7中部署的项目,可以使用ip访问,域名无法访问

作者:jenliang 时间:2019-09-05 17:39:49 0 删除 编辑

具体配置

server {

listen 80;

server_name 网址;

root /var/www/html/task;

location / {
        proxy_set_header x-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect  off;
        proxy_pass http://localhost:8001/; # gunicorn绑定的端口号
    }

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


目前有这样的问题:

直接访问网址可以看到nginx页面,但是访问(location /)中的项目的时候会出现 404,项目已经启动

把网址换成 IP 的时候都可以正常访问?请问是需要配置什么东西吗?

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4565/viewspace-3152817/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-15

  • 博文量
    189
  • 访问量
    858