有时候会需要添加,时间长了可能会忘记,还是记一下吧!就是添加绑定一个新的域名,先在DNSPod里面把域名解析到此服务器IP上,然后登陆SSH,执行以下操作以绑定此新域名。

[root@HQW-aliyun hack520]# /root/vhost.sh
=========================================================================
Add Virtual Host for LNMP , Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to add virtual host for nginx
For more information please visit http://www.lnmp.org/

=========================================================================
Please input domain:
(Default domain: www.lnmp.org):ihacksoft.com
===========================
domain=ihacksoft.com
===========================
Do you want to add more domain name? (y/n)
y
Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):
ihacksoft.com
===========================
domain list=ihacksoft.com
===========================
Please input the directory for the domain:ihacksoft.com :
(Default directory: /home/wwwroot/ihacksoft.com):/home/wwwroot/hack520
===========================
Virtual Host Directory=/home/wwwroot/hack520
===========================
===========================
Allow Rewrite rule? (y/n)
===========================
y
Please input the rewrite of programme :
wordpress,discuz,typecho,sablog,dabr rewrite was exist.
(Default rewrite: other):wordpress
===========================
You choose rewrite=wordpress
===========================
===========================
Allow access_log? (y/n)
===========================
y
Type access_log name(Default access log file:ihacksoft.com.log):

===========================
You access log file=ihacksoft.com.log
===========================

Press any key to start create virtul host...
Create Virtul Host directory......
set permissions of Virtual Host directory......
You select the exist rewrite rule:/usr/local/nginx/conf/wordpress.conf
Gracefully shutting down php-fpm . done
Starting php-fpm done
Test Nginx configure file......
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

Restart Nginx......
=========================================================================
Add Virtual Host for LNMP , Written by Licess
=========================================================================
For more information please visit http://www.lnmp.org/

Your domain:ihacksoft.com
Directory of ihacksoft.com:/home/wwwroot/hack520

=========================================================================
[root@HQW-aliyun hack520]#