WenRou's Blog
wdlinux如何增加站点或虚拟主机及文件说明
2013-9-27 温柔哥

可以用vhost.sh程序快速自动增加

具体请看 http://www.wdlinux.cn/node/124


有两种方式

一个是直接加在配置文件后面,如

/www/wdlinux/nginx/conf/nginx.conf

/www/wdlinux/apache/conf/httpd-vhost.conf


一个是将每个域名或虚拟主机独立为一个文件,放在如下的目录(注意,文件尾要以.conf为名,如 www.wdlinux.cn.conf )

nginx的虚拟主机配置文件目录 /www/wdlinux/nginx/conf/vhost

apache的虚拟主机配置文件目录 /www/wdlinux/apache/conf/vhost


然后保存重起相应服务即可,如

service nginxd restart

service httpd restart


apache的虚拟主机配置格式

<VirtualHost *:80>

    DocumentRoot "/www/web/wdlinux" 

    ServerName wdlinux.cn

    ServerAlias www.wdlinux.cn

    ErrorLog "logs/wdlinux.cn-error_log"

    CustomLog "logs/wdlinux.cn-access_log" common

</VirtualHost>


nginx的虚拟主机配置格式

    server {

        listen       80;

        server_name  wdlinux.cn;

        root /www/web/wdlinux;

        index  index.html index.php index.htm wdlinux.html;


        location ~ \.php$ {

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            include fcgi.conf;

        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

                expires      1d;

        }


        location ~ .*\.(js|css)?$ {

                expires      12h;

        }

    }


 上面的格式,域名和目录,根据自己的情况来修改


可以用vhost.sh程序来自动增加

 


发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容