VPS绑定多域名

八 22 2012 Published by under VPS

本人用的是LNMP,直接

sudo /root/vhost.sh

根据提示输入要绑定的新域名及目标文件夹,重启LNMP即可:

sudo /root/lnmp restart

完成之后会自动在/usr/local/nginx/conf/vhost文件夹下生成一个"域名.conf"文件。如果不能通过以上命令添加域名,那么以本域名为例,手动添加该文件:

sudo mkdir /usr/local/nginx/conf/vhost(默认情况下没有vhost文件夹)

 

sudo vi?/usr/local/nginx/conf/vhost/a-nerd.info.conf

server
{
listen 80;
server_name a-nerd.info;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot;include other.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}location ~ .*\.(js|css)?$
{
expires 12h;
}log_format a-nerd.info '$remote_addr - $remote_user [$time_local] $request '
'$status $body_bytes_sent $http_referer '
'$http_user_agent $http_x_forwarded_for';
access_log /home/wwwlogs/a-nerd.info.log a-nerd.info;
}

重启LNMP,同样效果。

本文链接地址: VPS绑定多域名



Tags:

No responses yet

发表评论