【问题标题】:nginx This site can't be reached errornginx无法访问此站点错误
【发布时间】:2022-02-19 23:06:25
【问题描述】:

我是 nginx 和 ubuntu 的新手。我refer this link & 在我的本地主机中设置了 nginx。当我点击 localhost 时,它工作正常且欢迎页面显示。 [参考附图] [localhost 和其他 2 个站点]Click here for see the image

当我从浏览器访问其他网站时,它会显示 无法访问此网站错误

请帮我解决这个问题。

/etc/nginx# ls -R sites-*
sites-available:
default  ve-server1.com  ve-server2.com

sites-enabled:
default  ve-server1.com  ve-server2.com

第一个文件

server {
listen   80;
server_name  www.ve-server1.com;
rewrite ^/(.*) http://ve-server1.com/$1 permanent;
}

server {

listen   80;
server_name ve-server1.com;

access_log /var/www/ve-server1.com/logs/access.log;
error_log /var/www/ve-server1.com/logs/error.log;

location / {

root   /var/www/ve-server1.com/public/;
index  index.html;
}
}

第二个文件

server {

listen   80;
server_name  www.ve-server2.com;
rewrite ^/(.*) http://ve-server2.com/$1 permanent;
}

server {

listen   80;
server_name ve-server2.com;

access_log /var/www/ve-server2.com/logs/access.log;
error_log /var/www/ve-server2.com/logs/error.log;

location / {

root   /var/www/ve-server2.com/public/;
index  index.html;
}
}

这里是 www 文件夹文件层次结构

/var/www# ls -R
.:
html  ve-server1.com  ve-server2.com

./html:
index.nginx-debian.html

./ve-server1.com:
logs  public

./ve-server1.com/logs:
access.log  error.log

./ve-server1.com/public:
index.html

./ve-server2.com:
logs  public

./ve-server2.com/logs:
access.log  error.log

./ve-server2.com/public:
index.html

我的 ubuntu 版本 16.10

谢谢
珍妮

【问题讨论】:

    标签: ubuntu nginx load-balancing


    【解决方案1】:

    必须在主机文件中添加这些服务器吗?

    也许这个链接会有所帮助。

    https://www.digitalocean.com/community/questions/how-to-bind-multiple-domains-ports-80-and-443-to-docker-contained-applications

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-07
      • 2016-07-06
      • 2020-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-09
      • 1970-01-01
      相关资源
      最近更新 更多