Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在本地主机(Ubuntu14.1)中使用NGINX服务器托管多个网站_Ubuntu_Nginx_Host - Fatal编程技术网

在本地主机(Ubuntu14.1)中使用NGINX服务器托管多个网站

在本地主机(Ubuntu14.1)中使用NGINX服务器托管多个网站,ubuntu,nginx,host,Ubuntu,Nginx,Host,为了承载多个网站,我更新了/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

为了承载多个网站,我更新了/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

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

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