可以用vhost.sh程序快速自動增加
具體請看 http://cd-genova.com/node/124
有兩種方式
一個是直接加在配置文件后面,如
/www/wdlinux/nginx/conf/nginx.conf
/www/wdlinux/apache/conf/httpd-vhost.conf
一個是將每個域名或虛擬主機獨立為一個文件,放在如下的目錄(注意,文件尾要以.conf為名,如cd-genova.com.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 cd-genova.com
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;
}
}
上面的格式,域名和目錄,根據(jù)自己的情況來修改
可以用vhost.sh程序來自動增加
具體請看 http://cd-genova.com/node/124