首页 > 其他 > 详细

nginx多站点配置

时间:2014-02-22 15:24:46      阅读:310      评论:0      收藏:0      [点我收藏+]


1.编辑nginx配置文件,在http里添加如下行

# vim/usr/local/nginx/conf/nginx.conf

http {

include vhost/*.conf;

}


2.创建存放主机的目录

# mkdir #vim /usr/local/nginx/conf/vhost


3.编辑虚拟主机,名字为osa.conf

# cd /usr/local/nginx/conf/vhost

# vimosa.conf

server

       {

       listen 90;

       server_name     www.benet.com;

       root   /usr/local/nginx/benet;

                  index         index.html index.htm index.php;


        location ~ \.php$ {

             root   /usr/local/nginx/benet;    #此处目录是nginx的网站根目录

             fastcgi_pass    127.0.0.1:9000;

             fastcgi_index   index.php;

             include         fastcgi.conf;

       }

}


4.编辑虚拟主机,名字为cc.conf

# cd /usr/local/nginx/conf/vhost

# vimosa.conf

server

       {

listen  9090;

       server_name     www.accp.com;

       root   /usr/local/nginx/accp;

       index index.html index.htm index.php;


        location ~ \.php$ {

             root    /usr/local/nginx/accp;

             fastcgi_pass    127.0.0.1:9000;

             fastcgi_index   index.php;

             include         fastcgi.conf;

       }

}


5.验证nginx是否有错误

# /usr/local/nginx/sbin/nginx -t

# /usr/local/nginx/sbin/nginx -s reload             重启nginx


nginx多站点配置

原文:http://lxw66.blog.51cto.com/5547576/1361861

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