【问题标题】:Host multiple websites using NGINX server in localhost (Ubuntu14.1)在 localhost (Ubuntu14.1) 中使用 NGINX 服务器托管多个网站
【发布时间】:2018-12-01 18:04:55
【问题描述】:

为了托管多个网站,我更新了 /etc/nginx/default 文件如下:

server {
    listen 8080;
    server_name test;
    root /var/www/test;
    client_max_body_size 3096M;
    location ~* \.(jpg|jpeg|png|gif|ico|css|js){
        expires max;
    }
}

在此之后,我将 /etc/hosts 文件编辑为:

IP address  localhost test;

最后一步:

service nginx restart / service nginx reload

使用 : http://test 访问网站,但它正在重定向到 localhost 并显示 Ubuntu 安装页面。

【问题讨论】:

    标签: ubuntu nginx host


    【解决方案1】:

    测试虚拟主机正在侦听端口 8080,因此您应该使用 http://test:8080 访问它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 2021-07-22
      • 2020-06-16
      • 2020-01-27
      • 2019-08-05
      相关资源
      最近更新 更多