<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>《留言本》的评论</title>
	<atom:link href="http://blog.licess.org/guestbook/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.licess.org</link>
	<description>关注VPS Linux Nginx MySQL PHP WEB开发 系统管理 服务器架构 Debian CentOS</description>
	<lastBuildDate>Thu, 12 Jan 2012 08:00:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>作者：夕月木</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-12130</link>
		<dc:creator>夕月木</dc:creator>
		<pubDate>Sun, 27 Nov 2011 13:15:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-12130</guid>
		<description>军哥你好
请问有什么支持IPV6的VPS推荐吗？
我现在用着YardVPS，很不稳定，22端口经常连不上。网站也常常打不开，但ping的话是可以的，延迟是200ms。
就是希望能有一个速度快、稳定点的空间，硬盘可以小点，因为我就是准备拿来做代理的。
谢谢军哥！</description>
		<content:encoded><![CDATA[<p>军哥你好<br />
请问有什么支持IPV6的VPS推荐吗？<br />
我现在用着YardVPS，很不稳定，22端口经常连不上。网站也常常打不开，但ping的话是可以的，延迟是200ms。<br />
就是希望能有一个速度快、稳定点的空间，硬盘可以小点，因为我就是准备拿来做代理的。<br />
谢谢军哥！</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：licess</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-11311</link>
		<dc:creator>licess</dc:creator>
		<pubDate>Fri, 04 Nov 2011 06:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-11311</guid>
		<description>@老妖, linode的vps上。</description>
		<content:encoded><![CDATA[<p>@老妖, linode的vps上。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：老妖</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-11299</link>
		<dc:creator>老妖</dc:creator>
		<pubDate>Fri, 04 Nov 2011 03:16:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-11299</guid>
		<description>现在博客放在什么主机上啊？很快啊。</description>
		<content:encoded><![CDATA[<p>现在博客放在什么主机上啊？很快啊。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：巢筑枝头</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-11179</link>
		<dc:creator>巢筑枝头</dc:creator>
		<pubDate>Wed, 02 Nov 2011 00:27:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-11179</guid>
		<description>博主，我刚才在盛大云主机安装好了lnmp包，最后面是显示如下，但是phpMyAdmin无法显示，mysql数据库怎么弄，鄙人代码盲，硬是按照你的教程走到安装完这一步的：
Install LNMP V0.7 completed! enjoy it.
=========================================================================
LNMP V0.7 for Ubuntu VPS , Written by Licess
=========================================================================

For more information please visit http://www.lnmp.org/

lnmp status manage: /root/lnmp {start&#124;stop&#124;reload&#124;restart&#124;kill&#124;status}
default mysql root password:12345678
phpinfo : http://vm-192-168-10-207.shengyun.grandcloud.cn/phpinfo.php
phpMyAdmin : http://vm-192-168-10-207.shengyun.grandcloud.cn/phpmyadmin/
Prober : http://vm-192-168-10-207.shengyun.grandcloud.cn/p.php

The path of some dirs:
mysql dir:   /usr/local/mysql
php dir:     /usr/local/php
nginx dir:   /usr/local/nginx
web dir :     /home/wwwroot

=========================================================================
=========================================================================
Manager for LNMP V0.7  ,  Written by Licess
=========================================================================
LNMP is a tool to auto-compile &amp; install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit http://www.lnmp.org

Usage: /root/lnmp {start&#124;stop&#124;reload&#124;restart&#124;kill&#124;status}
=========================================================================
Nginx is runing!
php-fpm is runing!
 * MySQL is not running
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN</description>
		<content:encoded><![CDATA[<p>博主，我刚才在盛大云主机安装好了lnmp包，最后面是显示如下，但是phpMyAdmin无法显示，mysql数据库怎么弄，鄙人代码盲，硬是按照你的教程走到安装完这一步的：<br />
Install LNMP V0.7 completed! enjoy it.<br />
=========================================================================<br />
LNMP V0.7 for Ubuntu VPS , Written by Licess<br />
=========================================================================</p>
<p>For more information please visit <a href="http://www.lnmp.org/" rel="nofollow">http://www.lnmp.org/</a></p>
<p>lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}<br />
default mysql root password:12345678<br />
phpinfo : <a href="http://vm-192-168-10-207.shengyun.grandcloud.cn/phpinfo.php" rel="nofollow">http://vm-192-168-10-207.shengyun.grandcloud.cn/phpinfo.php</a><br />
phpMyAdmin : <a href="http://vm-192-168-10-207.shengyun.grandcloud.cn/phpmyadmin/" rel="nofollow">http://vm-192-168-10-207.shengyun.grandcloud.cn/phpmyadmin/</a><br />
Prober : <a href="http://vm-192-168-10-207.shengyun.grandcloud.cn/p.php" rel="nofollow">http://vm-192-168-10-207.shengyun.grandcloud.cn/p.php</a></p>
<p>The path of some dirs:<br />
mysql dir:   /usr/local/mysql<br />
php dir:     /usr/local/php<br />
nginx dir:   /usr/local/nginx<br />
web dir :     /home/wwwroot</p>
<p>=========================================================================<br />
=========================================================================<br />
Manager for LNMP V0.7  ,  Written by Licess<br />
=========================================================================<br />
LNMP is a tool to auto-compile &amp; install Nginx+MySQL+PHP on Linux<br />
This script is a tool to Manage status of lnmp<br />
For more information please visit <a href="http://www.lnmp.org" rel="nofollow">http://www.lnmp.org</a></p>
<p>Usage: /root/lnmp {start|stop|reload|restart|kill|status}<br />
=========================================================================<br />
Nginx is runing!<br />
php-fpm is runing!<br />
 * MySQL is not running<br />
Active Internet connections (only servers)<br />
Proto Recv-Q Send-Q Local Address           Foreign Address         State<br />
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN<br />
tcp6       0      0 :::22                   :::*                    LISTEN</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：licess</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-10939</link>
		<dc:creator>licess</dc:creator>
		<pubDate>Wed, 26 Oct 2011 12:38:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-10939</guid>
		<description>@Quarry Equipments, php程序的话linux最合适</description>
		<content:encoded><![CDATA[<p>@Quarry Equipments, php程序的话linux最合适</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：licess</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-10938</link>
		<dc:creator>licess</dc:creator>
		<pubDate>Wed, 26 Oct 2011 12:37:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-10938</guid>
		<description>@jack, php -v 看一下php是哪个版本
可能是脚本判断版本错误。</description>
		<content:encoded><![CDATA[<p>@jack, php -v 看一下php是哪个版本<br />
可能是脚本判断版本错误。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Quarry Equipments</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-10579</link>
		<dc:creator>Quarry Equipments</dc:creator>
		<pubDate>Fri, 14 Oct 2011 07:59:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-10579</guid>
		<description>买vps是linux的好还是windows的好？</description>
		<content:encoded><![CDATA[<p>买vps是linux的好还是windows的好？</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：jack</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-10124</link>
		<dc:creator>jack</dc:creator>
		<pubDate>Mon, 26 Sep 2011 02:04:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-10124</guid>
		<description>licess ，您好
我装的是一键安装包。在启动php-fpm的时候遇到了

Starting php_fpm Failed loading /usr/local/ioncube/ioncube_loader_lin_5.3.so:  /usr/local/ioncube/ioncube_loader_lin_5.3.so: undefined symbol: zend_resolve_path

这种错误，请问有什么解决办法么？</description>
		<content:encoded><![CDATA[<p>licess ，您好<br />
我装的是一键安装包。在启动php-fpm的时候遇到了</p>
<p>Starting php_fpm Failed loading /usr/local/ioncube/ioncube_loader_lin_5.3.so:  /usr/local/ioncube/ioncube_loader_lin_5.3.so: undefined symbol: zend_resolve_path</p>
<p>这种错误，请问有什么解决办法么？</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：oldfox126</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-9371</link>
		<dc:creator>oldfox126</dc:creator>
		<pubDate>Tue, 28 Jun 2011 07:07:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-9371</guid>
		<description>军哥你好，我一直用你的LNMP装VPS，从0.4用到0.7，挺方便的，谢谢。

在用的过程中，我发现 /root/vhost.sh 这个脚本有些不方便的地方，就是只能添加网站，不能显示现有的网站也不能删除。
我尝试着按照你的脚本修改了一个，现在可以显示、添加和删除网站。删除的时候也不用自己输入域名，只要按数字编号就行了。
我把代码都发在这里，你看看有没有能用的代码。

再次感谢军哥及你创建的LNMP一键安装包。




/root/vhost.sh 
显示、添加及删除LNMP上的网站:



#!/bin/bash

get_char() {
	SAVEDSTTY=`stty -g`
	stty -echo
	stty cbreak
	dd if=/dev/tty bs=1 count=1 2&gt; /dev/null
	stty -raw
	stty echo
	stty $SAVEDSTTY
}

addVhost() {
	domain=&quot;www.lnmp.org&quot;
	echo &quot;Please input domain:&quot;
	read -p &quot;(Default domain: www.lnmp.org):&quot; domain
	if [ &#039;&#039; == &quot;$domain&quot; ]; then
		domain=&quot;www.lnmp.org&quot;
	fi

	if [ ! -f &quot;/usr/local/nginx/conf/vhost/$domain.conf&quot; ]; then
		echo &quot;===========================&quot;
		echo &quot;domain=$domain&quot;
		echo &quot;===========================&quot; 
	else
		echo &quot;===========================&quot;
		echo &quot;$domain is exist!&quot;
		echo &quot;===========================&quot;	
	fi
	
	moredomainame=&#039;&#039;
	echo &quot;Do you want to add more domain name? (y/n)&quot;
	read add_more_domainame
	if [ &#039;y&#039; == &quot;$add_more_domainame&quot; ]; then
	  echo &quot;Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):&quot;
	  read moredomain
	  echo &quot;===========================&quot;
	  echo &quot;domain list=$moredomain&quot;
	  echo &quot;===========================&quot;
	  moredomainame=&quot; $moredomain&quot;
	fi

	vhostdir=&quot;/home/wwwroot/$domain&quot;
	echo &quot;Please input the directory for the domain:$domain :&quot;
	read -p &quot;(Default directory: /home/wwwroot/$domain):&quot; vhostdir
	if [ &#039;&#039; == &quot;$vhostdir&quot; ]; then
		vhostdir=&quot;/home/wwwroot/$domain&quot;
	fi
	echo &quot;===========================&quot;
	echo &quot;Virtual Host Directory=$vhostdir&quot;
	echo &quot;===========================&quot;

	echo &quot;===========================&quot;
	echo &quot;Allow Rewrite rule? (y/n)&quot;
	echo &quot;===========================&quot;
	read allow_rewrite

	if [ &#039;n&#039; == &quot;$allow_rewrite&quot; ]; then
		rewrite=&quot;none&quot;
	else
		rewrite=&quot;other&quot;
		echo &quot;Please input the rewrite of program :&quot;
		echo &quot;wordpress,discuz,typecho,sablog,dabr rewrite was exist.&quot;
		read -p &quot;(Default rewrite: other):&quot; rewrite
		if [ &#039;&#039; == rewrite ]; then
			rewrite=&quot;other&quot;
		fi
	fi
	echo &quot;===========================&quot;
	echo &quot;You choose rewrite=$rewrite&quot;
	echo &quot;===========================&quot;

	echo &quot;===========================&quot;
	echo &quot;Allow access_log? (y/n)&quot;
	echo &quot;===========================&quot;
	read access_log

	if [ &#039;n&#039; == &quot;$access_log&quot; ]; then
	  al=&quot;access_log off;&quot;
	else
	  echo &quot;Type access_log name(Default access log file:$domain.log):&quot;
	  read al_name
	  if [ &#039;&#039; == &quot;$al_name&quot; ]; then
		al_name=&quot;$domain&quot;
	  fi

	  al=&quot;log_format  $al_name  &#039;\$remote_addr - \$remote_user [\$time_local] &quot;\$request&quot; &#039;
	     &#039;\$status \$body_bytes_sent &quot;\$http_referer&quot; &#039;
	     &#039;&quot;\$http_user_agent&quot; \$http_x_forwarded_for&#039;;
		access_log  $al_name.log  $al_name;&quot;
	fi
	echo &quot;===========================&quot;
	echo You access log file=&quot;$al_name.log&quot;
	echo &quot;===========================&quot;

	echo &quot;&quot;
	echo &quot;Press any key to start create virtul host...&quot;
	char=`get_char`

	if [ ! -d /usr/local/nginx/conf/vhost ]; then
		mkdir /usr/local/nginx/conf/vhost
	fi

	echo &quot;Create Virtul Host directory......&quot;
	mkdir -p $vhostdir
	echo &quot;set permissions of Virtual Host directory......&quot;
	chmod -R 755 $vhostdir
	chown -R www:www $vhostdir

	if [ ! -f /usr/local/nginx/conf/$rewrite.conf ]; then
		echo &quot;Create Virtul Host ReWrite file......&quot;
		touch &quot;/usr/local/nginx/conf/$rewrite.conf&quot;
		echo &quot;Create rewirte file successful,now you can add rewrite rule into /usr/local/nginx/conf/$rewrite.conf.&quot;
	else
		echo &quot;You select the exist rewrite rule:/usr/local/nginx/conf/$rewrite.conf&quot;
	fi

	cat &gt;/usr/local/nginx/conf/vhost/$domain.conf&lt;&lt;eof
	server
		{
			listen       80;
			server_name $domain$moredomainame;
			index index.html index.htm index.php default.html default.htm default.php;
			root  $vhostdir;

			include $rewrite.conf;
			location ~ .*\.(php&#124;php5)?$
				{
					fastcgi_pass  unix:/tmp/php-cgi.sock;
					fastcgi_index index.php;
					include fcgi.conf;
				}

			location ~ .*\.(gif&#124;jpg&#124;jpeg&#124;png&#124;bmp&#124;swf)$
				{
					expires      30d;
				}

			location ~ .*\.(js&#124;css)?$
				{
					expires      12h;
				}

			$al
		}
eof

	echo &quot;Test Nginx configure file......&quot;
	/usr/local/nginx/sbin/nginx -t
	echo &quot;...Done!&quot;

	echo &quot;Restart Nginx......&quot;
	kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
	echo &quot;...Done!&quot;

	echo &quot;&quot;
	echo &quot;=========================================================================&quot;
	echo &quot;Your domain:$domain&quot;
	echo &quot;Directory of $domain:$vhostdir&quot;
	echo &quot;Add $domain Ok!&quot;
	echo &quot;=========================================================================&quot;
}

deleteVhost() {
	echo &quot;Type 1...$vhostCount to delete domain:&quot;
	read -p &quot;type other Cancel delete:&quot; domainIndex

	case &quot;$domainIndex&quot; in
		[0-9]	 ) ;;
		[0-9][0-9]	 ) ;;
		*	) {
			echo &quot;Cancel delete domain,Exit!&quot;
			echo &quot;&quot;
			exit 0
		};;
	esac
	
	echo &quot;&quot;
	domain=${vhosts[$domainIndex]}

	if [ 0 == ${#domain} ]; then
		echo &quot;you select a domain that not exists&quot;
		echo &quot;Cancel delete domain,Exit!&quot;
		echo &quot;&quot;
		exit 0
	fi

	vhostfile=&quot;/usr/local/nginx/conf/vhost/$domain.conf&quot;
	if [ ! -f &quot;$vhostfile&quot; ]; then
		echo &quot;domain [$domain=vhostfile] din&#039;t exists , Exit !&quot;
		exit 1
	fi

	echo &quot;Do you realy want delete domain [$domain]:&quot;
	read -p &quot;Type y/n(Default not,cancel detele and exit),y/n:&quot; confirm
	if [ &#039;y&#039; != &quot;$confirm&quot; ]; then
		echo &quot;Cancel delete domain [$domain],Exit!&quot;
		exit 1
	fi
	
	echo &quot;delete domain [$domain] ...&quot;
	rm -rf &quot;$vhostfile&quot;
	echo &quot;... OK!&quot;

	echo &quot;Restart Nginx......&quot;
	kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
	echo &quot;... Done!&quot;
	echo &quot;&quot;
	
	domaindir=&quot;/home/wwwroot/$domain&quot;
	if [ ! -d &quot;$domaindir&quot; ]; then
		exit 1
	fi

	echo &quot;Delete domain dir [$domaindir]?&quot;
	read -p &quot;Default not delete, y/n:&quot; deleteDomainDir
	if [ &#039;y&#039; != &quot;$deleteDomainDir&quot; ]; then
		echo &quot;Cancel delete domain dir [$domaindir],Exit!&quot;
		exit 1
	fi

	echo &quot;Do you realy want delete domain dir [$domaindir]? the files will lost !&quot;
	read -p &quot;Type y/n(Default not,cancel detele and exit),y/n:&quot; confirm
	if [ &#039;y&#039; != &quot;$confirm&quot; ]; then
		echo &quot;Cancel delete domain dir [$domaindir],Exit!&quot;
		exit 1
	fi

	echo &quot;delete domain dir [$domaindir] ...&quot;
	rm -rf &quot;$domaindir&quot;
	echo &quot;... OK!&quot;
	echo &quot;&quot;
}

doVhost() {
	exit 0
}

showVhost() {
	vhostlist=`ls /usr/local/nginx/conf/vhost`
	vhostlist=${vhostlist//\.conf/}
	
	echo &quot;&quot;
	echo &quot;=========================================================================&quot;
	echo &quot;some domains on your server:&quot;

	vhostCount=1
	for vhost in $vhostlist
	do
		echo &quot;[$vhostCount] $vhost&quot;
		vhosts[$vhostCount]=$vhost
		let vhostCount=$vhostCount+1
	done
	let vhostCount=$vhostCount-1

	return 0
}

# Check if user is root
if [ $(id -u) != &quot;0&quot; ]; then
    echo &quot;Error: You must be root to run this script, use sudo sh $0&quot;
    exit 1
fi

declare -a vhosts
vhostCount=0

clear
echo &quot;=========================================================================&quot;
echo &quot;Virtual Host Manager for LNMP V0.4  ,  Written by oldfox126@foxmail.com &quot;
echo &quot;=========================================================================&quot;
echo &quot;LNMP is a tool to auto-compile &amp; install Nginx+MySQL+PHP on Linux &quot;
echo &quot;This script is a tool to add virtual host for nginx &quot;
echo &quot;For more information please visit http://www.lnmp.org/&quot;
echo &quot;&quot;
echo &quot;=========================================================================&quot;

case &quot;$1&quot; in
        add)
                addVhost
                ;;
	update)
                addVhost
                ;;
        delete)
                deleteVhost
                ;;
	do)
                doVhost
                ;;
        *)
		showVhost
		echo &quot;&quot;
                echo &quot;Usage: /root/vhost {add&#124;delete&#124;update}&quot;
		read -p &quot;Please Type add,delete,update! or Type Other to Exit:&quot; action
		
		if [ &#039;add&#039; == &quot;$action&quot; ]; then
			addVhost
			exit 1
		fi

		if [ &#039;update&#039; == &quot;$action&quot; ]; then
			addVhost
			exit 1
		fi

		if [ &#039;delete&#039; == &quot;$action&quot; ]; then
			deleteVhost
			exit 1
		fi

		if [ &#039;do&#039; == &quot;$action&quot; ]; then
			doVhost
			exit 1
		fi

		echo &quot;Cancel do domain,Exit!&quot;
esac
exit</description>
		<content:encoded><![CDATA[<p>军哥你好，我一直用你的LNMP装VPS，从0.4用到0.7，挺方便的，谢谢。</p>
<p>在用的过程中，我发现 /root/vhost.sh 这个脚本有些不方便的地方，就是只能添加网站，不能显示现有的网站也不能删除。<br />
我尝试着按照你的脚本修改了一个，现在可以显示、添加和删除网站。删除的时候也不用自己输入域名，只要按数字编号就行了。<br />
我把代码都发在这里，你看看有没有能用的代码。</p>
<p>再次感谢军哥及你创建的LNMP一键安装包。</p>
<p>/root/vhost.sh<br />
显示、添加及删除LNMP上的网站:</p>
<p>#!/bin/bash</p>
<p>get_char() {<br />
	SAVEDSTTY=`stty -g`<br />
	stty -echo<br />
	stty cbreak<br />
	dd if=/dev/tty bs=1 count=1 2&gt; /dev/null<br />
	stty -raw<br />
	stty echo<br />
	stty $SAVEDSTTY<br />
}</p>
<p>addVhost() {<br />
	domain="www.lnmp.org"<br />
	echo "Please input domain:"<br />
	read -p "(Default domain: <a href="http://www.lnmp.org" rel="nofollow">http://www.lnmp.org</a>):" domain<br />
	if [ '' == "$domain" ]; then<br />
		domain="www.lnmp.org"<br />
	fi</p>
<p>	if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then<br />
		echo "==========================="<br />
		echo "domain=$domain"<br />
		echo "==========================="<br />
	else<br />
		echo "==========================="<br />
		echo "$domain is exist!"<br />
		echo "==========================="<br />
	fi</p>
<p>	moredomainame=''<br />
	echo "Do you want to add more domain name? (y/n)"<br />
	read add_more_domainame<br />
	if [ 'y' == "$add_more_domainame" ]; then<br />
	  echo "Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):"<br />
	  read moredomain<br />
	  echo "==========================="<br />
	  echo "domain list=$moredomain"<br />
	  echo "==========================="<br />
	  moredomainame=" $moredomain"<br />
	fi</p>
<p>	vhostdir="/home/wwwroot/$domain"<br />
	echo "Please input the directory for the domain:$domain :"<br />
	read -p "(Default directory: /home/wwwroot/$domain):" vhostdir<br />
	if [ '' == "$vhostdir" ]; then<br />
		vhostdir="/home/wwwroot/$domain"<br />
	fi<br />
	echo "==========================="<br />
	echo "Virtual Host Directory=$vhostdir"<br />
	echo "==========================="</p>
<p>	echo "==========================="<br />
	echo "Allow Rewrite rule? (y/n)"<br />
	echo "==========================="<br />
	read allow_rewrite</p>
<p>	if [ 'n' == "$allow_rewrite" ]; then<br />
		rewrite="none"<br />
	else<br />
		rewrite="other"<br />
		echo "Please input the rewrite of program :"<br />
		echo "wordpress,discuz,typecho,sablog,dabr rewrite was exist."<br />
		read -p "(Default rewrite: other):" rewrite<br />
		if [ '' == rewrite ]; then<br />
			rewrite="other"<br />
		fi<br />
	fi<br />
	echo "==========================="<br />
	echo "You choose rewrite=$rewrite"<br />
	echo "==========================="</p>
<p>	echo "==========================="<br />
	echo "Allow access_log? (y/n)"<br />
	echo "==========================="<br />
	read access_log</p>
<p>	if [ 'n' == "$access_log" ]; then<br />
	  al="access_log off;"<br />
	else<br />
	  echo "Type access_log name(Default access log file:$domain.log):"<br />
	  read al_name<br />
	  if [ '' == "$al_name" ]; then<br />
		al_name="$domain"<br />
	  fi</p>
<p>	  al="log_format  $al_name  '\$remote_addr - \$remote_user [\$time_local] "\$request" '<br />
	     '\$status \$body_bytes_sent "\$http_referer" '<br />
	     '"\$http_user_agent" \$http_x_forwarded_for';<br />
		access_log  $al_name.log  $al_name;"<br />
	fi<br />
	echo "==========================="<br />
	echo You access log file="$al_name.log"<br />
	echo "==========================="</p>
<p>	echo ""<br />
	echo "Press any key to start create virtul host..."<br />
	char=`get_char`</p>
<p>	if [ ! -d /usr/local/nginx/conf/vhost ]; then<br />
		mkdir /usr/local/nginx/conf/vhost<br />
	fi</p>
<p>	echo "Create Virtul Host directory......"<br />
	mkdir -p $vhostdir<br />
	echo "set permissions of Virtual Host directory......"<br />
	chmod -R 755 $vhostdir<br />
	chown -R www:www $vhostdir</p>
<p>	if [ ! -f /usr/local/nginx/conf/$rewrite.conf ]; then<br />
		echo "Create Virtul Host ReWrite file......"<br />
		touch "/usr/local/nginx/conf/$rewrite.conf"<br />
		echo "Create rewirte file successful,now you can add rewrite rule into /usr/local/nginx/conf/$rewrite.conf."<br />
	else<br />
		echo "You select the exist rewrite rule:/usr/local/nginx/conf/$rewrite.conf"<br />
	fi</p>
<p>	cat &gt;/usr/local/nginx/conf/vhost/$domain.conf&lt;&lt;eof<br />
	server<br />
		{<br />
			listen       80;<br />
			server_name $domain$moredomainame;<br />
			index index.html index.htm index.php default.html default.htm default.php;<br />
			root  $vhostdir;</p>
<p>			include $rewrite.conf;<br />
			location ~ .*\.(php|php5)?$<br />
				{<br />
					fastcgi_pass  unix:/tmp/php-cgi.sock;<br />
					fastcgi_index index.php;<br />
					include fcgi.conf;<br />
				}</p>
<p>			location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$<br />
				{<br />
					expires      30d;<br />
				}</p>
<p>			location ~ .*\.(js|css)?$<br />
				{<br />
					expires      12h;<br />
				}</p>
<p>			$al<br />
		}<br />
eof</p>
<p>	echo &quot;Test Nginx configure file......&quot;<br />
	/usr/local/nginx/sbin/nginx -t<br />
	echo &quot;...Done!&quot;</p>
<p>	echo &quot;Restart Nginx......&quot;<br />
	kill -HUP `cat /usr/local/nginx/logs/nginx.pid`<br />
	echo &quot;...Done!&quot;</p>
<p>	echo &quot;&quot;<br />
	echo &quot;=========================================================================&quot;<br />
	echo &quot;Your domain:$domain&quot;<br />
	echo &quot;Directory of $domain:$vhostdir&quot;<br />
	echo &quot;Add $domain Ok!&quot;<br />
	echo &quot;=========================================================================&quot;<br />
}</p>
<p>deleteVhost() {<br />
	echo &quot;Type 1...$vhostCount to delete domain:&quot;<br />
	read -p &quot;type other Cancel delete:&quot; domainIndex</p>
<p>	case &quot;$domainIndex&quot; in<br />
		[0-9]	 ) ;;<br />
		[0-9][0-9]	 ) ;;<br />
		*	) {<br />
			echo &quot;Cancel delete domain,Exit!&quot;<br />
			echo &quot;&quot;<br />
			exit 0<br />
		};;<br />
	esac</p>
<p>	echo &quot;&quot;<br />
	domain=${vhosts[$domainIndex]}</p>
<p>	if [ 0 == ${#domain} ]; then<br />
		echo &quot;you select a domain that not exists&quot;<br />
		echo &quot;Cancel delete domain,Exit!&quot;<br />
		echo &quot;&quot;<br />
		exit 0<br />
	fi</p>
<p>	vhostfile=&quot;/usr/local/nginx/conf/vhost/$domain.conf&quot;<br />
	if [ ! -f &quot;$vhostfile&quot; ]; then<br />
		echo &quot;domain [$domain=vhostfile] din&#039;t exists , Exit !&quot;<br />
		exit 1<br />
	fi</p>
<p>	echo &quot;Do you realy want delete domain [$domain]:&quot;<br />
	read -p &quot;Type y/n(Default not,cancel detele and exit),y/n:&quot; confirm<br />
	if [ &#039;y&#039; != &quot;$confirm&quot; ]; then<br />
		echo &quot;Cancel delete domain [$domain],Exit!&quot;<br />
		exit 1<br />
	fi</p>
<p>	echo &quot;delete domain [$domain] ...&quot;<br />
	rm -rf &quot;$vhostfile&quot;<br />
	echo &quot;... OK!&quot;</p>
<p>	echo &quot;Restart Nginx......&quot;<br />
	kill -HUP `cat /usr/local/nginx/logs/nginx.pid`<br />
	echo &quot;... Done!&quot;<br />
	echo &quot;&quot;</p>
<p>	domaindir=&quot;/home/wwwroot/$domain&quot;<br />
	if [ ! -d &quot;$domaindir&quot; ]; then<br />
		exit 1<br />
	fi</p>
<p>	echo &quot;Delete domain dir [$domaindir]?&quot;<br />
	read -p &quot;Default not delete, y/n:&quot; deleteDomainDir<br />
	if [ &#039;y&#039; != &quot;$deleteDomainDir&quot; ]; then<br />
		echo &quot;Cancel delete domain dir [$domaindir],Exit!&quot;<br />
		exit 1<br />
	fi</p>
<p>	echo &quot;Do you realy want delete domain dir [$domaindir]? the files will lost !&quot;<br />
	read -p &quot;Type y/n(Default not,cancel detele and exit),y/n:&quot; confirm<br />
	if [ &#039;y&#039; != &quot;$confirm&quot; ]; then<br />
		echo &quot;Cancel delete domain dir [$domaindir],Exit!&quot;<br />
		exit 1<br />
	fi</p>
<p>	echo &quot;delete domain dir [$domaindir] ...&quot;<br />
	rm -rf &quot;$domaindir&quot;<br />
	echo &quot;... OK!&quot;<br />
	echo &quot;&quot;<br />
}</p>
<p>doVhost() {<br />
	exit 0<br />
}</p>
<p>showVhost() {<br />
	vhostlist=`ls /usr/local/nginx/conf/vhost`<br />
	vhostlist=${vhostlist//\.conf/}</p>
<p>	echo &quot;&quot;<br />
	echo &quot;=========================================================================&quot;<br />
	echo &quot;some domains on your server:&quot;</p>
<p>	vhostCount=1<br />
	for vhost in $vhostlist<br />
	do<br />
		echo &quot;[$vhostCount] $vhost&quot;<br />
		vhosts[$vhostCount]=$vhost<br />
		let vhostCount=$vhostCount+1<br />
	done<br />
	let vhostCount=$vhostCount-1</p>
<p>	return 0<br />
}</p>
<p># Check if user is root<br />
if [ $(id -u) != &quot;0&quot; ]; then<br />
    echo &quot;Error: You must be root to run this script, use sudo sh $0&quot;<br />
    exit 1<br />
fi</p>
<p>declare -a vhosts<br />
vhostCount=0</p>
<p>clear<br />
echo &quot;=========================================================================&quot;<br />
echo &quot;Virtual Host Manager for LNMP V0.4  ,  Written by <a href="mailto:oldfox126@foxmail.com">oldfox126@foxmail.com</a> &quot;<br />
echo &quot;=========================================================================&quot;<br />
echo &quot;LNMP is a tool to auto-compile &amp; install Nginx+MySQL+PHP on Linux &quot;<br />
echo &quot;This script is a tool to add virtual host for nginx &quot;<br />
echo &quot;For more information please visit <a href="http://www.lnmp.org/&#038;quot" rel="nofollow">http://www.lnmp.org/&#038;quot</a>;<br />
echo &quot;&quot;<br />
echo &quot;=========================================================================&quot;</p>
<p>case &quot;$1&quot; in<br />
        add)<br />
                addVhost<br />
                ;;<br />
	update)<br />
                addVhost<br />
                ;;<br />
        delete)<br />
                deleteVhost<br />
                ;;<br />
	do)<br />
                doVhost<br />
                ;;<br />
        *)<br />
		showVhost<br />
		echo &quot;&quot;<br />
                echo &quot;Usage: /root/vhost {add|delete|update}&quot;<br />
		read -p &quot;Please Type add,delete,update! or Type Other to Exit:&quot; action</p>
<p>		if [ &#039;add&#039; == &quot;$action&quot; ]; then<br />
			addVhost<br />
			exit 1<br />
		fi</p>
<p>		if [ &#039;update&#039; == &quot;$action&quot; ]; then<br />
			addVhost<br />
			exit 1<br />
		fi</p>
<p>		if [ &#039;delete&#039; == &quot;$action&quot; ]; then<br />
			deleteVhost<br />
			exit 1<br />
		fi</p>
<p>		if [ &#039;do&#039; == &quot;$action&quot; ]; then<br />
			doVhost<br />
			exit 1<br />
		fi</p>
<p>		echo &quot;Cancel do domain,Exit!&quot;<br />
esac<br />
exit</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：licess</title>
		<link>http://blog.licess.org/guestbook/comment-page-2/#comment-9170</link>
		<dc:creator>licess</dc:creator>
		<pubDate>Tue, 17 May 2011 01:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.licess.cn/?page_id=460#comment-9170</guid>
		<description>@crusher, 用/root/vhost.sh 直接添加域名，提示伪静态的时候输入wordpress即可。</description>
		<content:encoded><![CDATA[<p>@crusher, 用/root/vhost.sh 直接添加域名，提示伪静态的时候输入wordpress即可。</p>
]]></content:encoded>
	</item>
</channel>
</rss>

