首页 > 其他 > 详细

nginx基于端口

时间:2017-04-30 00:47:02      阅读:359      评论:0      收藏:0      [点我收藏+]

基于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 :::* 


nginx基于端口

原文:http://12187655.blog.51cto.com/12177655/1920709

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!