nginx 请求多个域名指定对应的根目录

时间:2021-02-27 13:10:39   收藏:0   阅读:0

同一个nginx配置文件,请求不同的域名可以指定对应的目录

cat long.conf

server {
        listen       80;

        server_name  a.com b.com c.com;


	location / {
		root /home/long/$host/;
		index index.html;
	}


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

   }
cd /home/long
mkdir a.com b.com c.com
#对应目录下创建index.html文件
echo ‘test a.com‘ a.com/index.html
...
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!