[Nginx]nginx配置虛擬主機

  1. 端口綁定
  #端口綁定  
    server {
        listen       81;
        server_name  localhost;

     
        location / {
            root   cart;
            index  cart.html;
        }
       
    }
    server {
        listen       82;
        server_name  localhost;

     
        location / {
            root   search;
            index  search.html;
        }
   
    }

2. 域名綁定

 #域名綁定
    server {
        listen       80;
        server_name  cart.pinyougou.com;

     
        location / {
            root   cart;
            index  cart.html;
        }
   
    }

    server {
        listen       80;
        server_name  search.pinyougou.com;

     
        location / {
            root   search;
            index  search.html;
        }
   
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章