可以用vhost.sh程序快速自動(dòng)增加
具體請(qǐng)看 http://www.fudaan.com/node/124
有兩種方式
一個(gè)是直接加在配置文件后面,如
/www/wdlinux/nginx/conf/nginx.conf
/www/wdlinux/apache/conf/httpd-vhost.conf
一個(gè)是將每個(gè)域名或虛擬主機(jī)獨(dú)立為一個(gè)文件,放在如下的目錄(注意,文件尾要以.conf為名,如www.fudaan.com.conf)
nginx的虛擬主機(jī)配置文件目錄 /www/wdlinux/nginx/conf/vhost
apache的虛擬主機(jī)配置文件目錄 /www/wdlinux/apache/conf/vhost
然后保存重起相應(yīng)服務(wù)即可,如
service nginxd restart
service httpd restart
apache的虛擬主機(jī)配置格式
<VirtualHost *:80>
DocumentRoot "/www/web/wdlinux"
ServerName wdlinux.cn
ServerAlias www.fudaan.com
ErrorLog "logs/wdlinux.cn-error_log"
CustomLog "logs/wdlinux.cn-access_log" common
</VirtualHost>
nginx的虛擬主機(jī)配置格式
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ù)自己的情況來(lái)修改
可以用vhost.sh程序來(lái)自動(dòng)增加
具體請(qǐng)看 http://www.fudaan.com/node/124