nginx基於端口

基於IP端口虛擬主機

如果 配置基於端口的虛擬主機,就需要每個虛擬主機配置有不同的端口


[root@localhost extra]# vim nginx_vhosts.conf

    server {

        listen       8060;

        server_name  www.you.com you.com;

        location / {

            root   /data0/www/www;

            index  index.html index.htm;

            access_log /app/logs/www_access.log  commonlog;

        }

    }

######

server {

        listen       8070;

        server_name  www.bbs.com bbs.com;

        location / {

            root   /data0/www/bbs;

            index  index.html index.htm;

            access_log /app/logs/bbs_access.log  commonlog;

        }

    }

######

server {

        listen       8080;

        server_name  www.blog.com blog.com;

        location / {

            root   /data0/www/blog;

            index  index.html index.html;

            access_log /app/logs/blog_access.log  commonlog;

        }

    }

server {

        listen       80;

        server_name  status.you.com;

        location / {

          stub_status on;

          access_log off;

        }

    }



[root@localhost extra]# ../sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

[root@localhost extra]# ../sbin/nginx -s reload

[root@localhost extra]# netstat -tlun | grep 80

tcp        0      0 0.0.0.0:8070                0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:8060                0.0.0.0:*                   LISTEN      

udp        0      0 fe80::20c:29ff:fe74:1824:123 :::* 


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