基于主机头的虚拟主机

 

【基于主机头的虚拟主机】(vim /etc/nginx/nginx.conf)

server {

        listen       192.168.145.100:80;

        server_name  www.wpp.com;

 

        location / {

            root   html;

            index  index.html index.htm;

        }

        error_log  /var/log/nginx/error.log;

        access_log /var/log/nginx/access.log;

 

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }

}

server {

        listen       192.168.145.100:80;

        server_name  tec.wpp.com;

 

        location / {

            root   /tec;(这个目录要自己建立,目录下放置主页html文件

            index  index.html index.htm;

        }

        error_log  /var/log/nginx/tec_error.log;

        access_log /var/log/nginx/tec_access.log;

 

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }

}

 

 

你可能感兴趣的:(虚拟主机,主机)