nginx此网站无法达到错误

时间:2017-02-21 12:12:39

标签: ubuntu nginx load-balancing

我是nginx&的新手。 Ubuntu Linux系统。我refer this link&在我的localhost中设置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

感谢
珍妮

1 个答案:

答案 0 :(得分:0)

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

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

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