<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>wolfg&#039;s Weblog &#187; nginx</title>
	<atom:link href="http://guoyong.me/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>http://guoyong.me</link>
	<description>wolfg&#039;s journey with open source, linux, programming, sysadm ...</description>
	<lastBuildDate>Wed, 04 Apr 2012 12:42:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/cn/</creativeCommons:license>		<item>
		<title>用于修复旧的下载链接的Nginx Rewrite规则</title>
		<link>http://guoyong.me/linux/nginx-the-rewrite-url-based-on-get-parameter/</link>
		<comments>http://guoyong.me/linux/nginx-the-rewrite-url-based-on-get-parameter/#comments</comments>
		<pubDate>Sun, 11 Mar 2012 14:18:12 +0000</pubDate>
		<dc:creator>guoyong</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rewrite]]></category>

		<guid isPermaLink="false">http://guoyong.me/?p=926</guid>
		<description><![CDATA[旧的下载链接是这样的： /?dl=file 由于原来处理下载请求的插件不工作了，所以就用Nginx的rewrite来修复。 &#160;if ($args ~* &#34;^dl=(.*)&#34;) { &#160; &#160; &#160;set $f $1; &#160; &#160; &#160;rewrite ^.*$ /downloads/$f last; &#160;}]]></description>
			<content:encoded><![CDATA[<p>旧的下载链接是这样的：</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/?dl=file</div></div>
<p>由于原来处理下载请求的插件不工作了，所以就用Nginx的rewrite来修复。</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;if ($args ~* &quot;^dl=(.*)&quot;) {<br />
&nbsp; &nbsp; &nbsp;set $f $1;<br />
&nbsp; &nbsp; &nbsp;rewrite ^.*$ /downloads/$f last;<br />
&nbsp;}</div></div>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/nginx-the-rewrite-url-based-on-get-parameter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Nginx from source with &#8216;Debian&#8217; layout</title>
		<link>http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/</link>
		<comments>http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 08:10:56 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=371</guid>
		<description><![CDATA[1. 创建相关目录 $ sudo mkdir /etc/nginx$ sudo mkdir /etc/nginx/conf.d$ sudo mkdir /etc/nginx/sites-available$ sudo mkdir /etc/nginx/sites-enabled$ sudo mkdir /var/log/nginx$ sudo mkdir -p /var/lib/nginx/body$ sudo mkdir /var/lib/nginx/proxy$ sudo mkdir /var/lib/nginx/fastcgi 2. 编译安装 $ ./configure --prefix=/usr \--sbin-path=/usr/sbin/nginx \--conf-path=/etc/nginx/nginx.conf \--lock-path=/var/lock/nginx.lock \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/var/run/nginx.pid \--user=www-data &#8230; <a href="http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>1. 创建相关目录</p>
<div class="hl-surround"><div class="hl-main">$ sudo mkdir /etc/nginx<br />$ sudo mkdir /etc/nginx/conf.d<br />$ sudo mkdir /etc/nginx/sites-available<br />$ sudo mkdir /etc/nginx/sites-enabled<br />$ sudo mkdir /var/log/nginx<br />$ sudo mkdir -p /var/lib/nginx/body<br />$ sudo mkdir /var/lib/nginx/proxy<br />$ sudo mkdir /var/lib/nginx/fastcgi</div></div>
<p>2. 编译安装</p>
<div class="hl-surround"><div class="hl-main">$ ./configure --prefix=/usr \<br />--sbin-path=/usr/sbin/nginx \<br />--conf-path=/etc/nginx/nginx.conf \<br />--lock-path=/var/lock/nginx.lock \<br />--error-log-path=/var/log/nginx/error.log \<br />--http-log-path=/var/log/nginx/access.log \<br />--pid-path=/var/run/nginx.pid \<br />--user=www-data \<br />--group=www-data \<br />--http-client-body-temp-path=/var/lib/nginx/body \<br />--http-proxy-temp-path=/var/lib/nginx/proxy \<br />--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \<br />--with-md5=/usr/lib \<br />--with-sha1=/usr/lib \<br />--with-http_ssl_module \<br />--with-http_gzip_static_module \<br />--with-pcre \<br />--without-mail_pop3_module \<br />--without-mail_imap_module \<br />--without-mail_smtp_module \<br />--with-http_stub_status_module<br /><br />$ make<br />$ sudo make install<br />$ sudo mv /usr/html /var/www/nginx-default</div></div>
<p>3. 修改配置文件<br />
/etc/nginx/nginx.conf</p>
<div class="hl-surround"><div class="hl-main">user www-data;<br />worker_processes&nbsp; 5;<br /><br />error_log&nbsp; /var/log/nginx/error.log;<br />pid&nbsp; &nbsp; &nbsp; &nbsp; /var/run/nginx.pid;<br /><br />events {<br />&nbsp;&nbsp; &nbsp;worker_connections&nbsp; 1024;<br />}<br /><br />http {<br />&nbsp;&nbsp; &nbsp;server_tokens off;<br />&nbsp;&nbsp; &nbsp;include&nbsp; &nbsp; &nbsp; &nbsp;/etc/nginx/mime.types;<br />&nbsp;&nbsp; &nbsp;default_type&nbsp; application/octet-stream;<br /><br />&nbsp;&nbsp; &nbsp;access_log&nbsp; /var/log/nginx/access.log;<br /><br />&nbsp;&nbsp; &nbsp;sendfile&nbsp; &nbsp; &nbsp; &nbsp; on;<br />&nbsp;&nbsp; &nbsp;#tcp_nopush&nbsp; &nbsp; &nbsp;on;<br /><br />&nbsp;&nbsp; &nbsp;#keepalive_timeout&nbsp; 0;<br />&nbsp;&nbsp; &nbsp;keepalive_timeout&nbsp; 65;<br />&nbsp;&nbsp; &nbsp;tcp_nodelay&nbsp; &nbsp; &nbsp; &nbsp; on;<br />&nbsp;&nbsp; &nbsp;gzip&nbsp; on;<br /><br />&nbsp;&nbsp; &nbsp;include /etc/nginx/conf.d/*.conf;<br />&nbsp;&nbsp; &nbsp;include /etc/nginx/sites-enabled/*;<br />}</div></div>
<p>/etc/nginx/sites-available/default</p>
<div class="hl-surround"><div class="hl-main">server {<br />&nbsp;&nbsp; &nbsp;listen&nbsp; &nbsp; &nbsp; &nbsp;80;<br />&nbsp;&nbsp; &nbsp;server_name&nbsp; localhost;<br /><br />&nbsp;&nbsp; &nbsp;location / {<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;root&nbsp; &nbsp;/var/www/nginx-default;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;index&nbsp; index.html index.htm;<br />&nbsp;&nbsp; &nbsp;}<br /><br /><br />&nbsp;&nbsp; &nbsp;# redirect server error pages to the static page /50x.html<br />&nbsp;&nbsp; &nbsp;#<br />&nbsp;&nbsp; &nbsp;error_page&nbsp; &nbsp;500 502 503 504&nbsp; /50x.html;<br />&nbsp;&nbsp; &nbsp;location = /50x.html {<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;root&nbsp; &nbsp;/var/www/nginx-default;<br />&nbsp;&nbsp; &nbsp;}<br />}</div></div>
<p>启用default vhost</p>
<div class="hl-surround"><div class="hl-main">sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default</div></div>
<p>4. 创建init脚本<br />
$ sudo vi /etc/init.d/nginx</p>
<div class="hl-surround"><div class="hl-main">#! /bin/sh<br /><br />### BEGIN INIT INFO<br /># Provides:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nginx<br /># Required-Start:&nbsp; &nbsp; $all<br /># Required-Stop:&nbsp; &nbsp; &nbsp;$all<br /># Default-Start:&nbsp; &nbsp; &nbsp;2 3 4 5<br /># Default-Stop:&nbsp; &nbsp; &nbsp; 0 1 6<br /># Short-Description: starts the nginx web server<br /># Description:&nbsp; &nbsp; &nbsp; &nbsp;starts nginx using start-stop-daemon<br />### END INIT INFO<br /><br />PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br />DAEMON=/usr/sbin/nginx<br />NAME=nginx<br />DESC=nginx<br /><br />test -x $DAEMON || exit 0<br /><br /># Include nginx defaults if available<br />if [ -f /etc/default/nginx ] ; then<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;. /etc/default/nginx<br />fi<br /><br />set -e<br /><br />. /lib/lsb/init-functions<br /><br />case &quot;$1&quot; in<br />&nbsp; start)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo -n &quot;Starting $DESC: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--exec $DAEMON -- $DAEMON_OPTS || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />&nbsp; stop)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo -n &quot;Stopping $DESC: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--exec $DAEMON || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />&nbsp; restart|force-reload)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo -n &quot;Restarting $DESC: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --stop --quiet --pidfile \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/var/run/$NAME.pid --exec $DAEMON || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sleep 1<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --start --quiet --pidfile \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />&nbsp; reload)<br />&nbsp;&nbsp; &nbsp; &nbsp;echo -n &quot;Reloading $DESC configuration: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp;start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--exec $DAEMON || true<br />&nbsp;&nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp;;;<br />&nbsp; status)<br />&nbsp;&nbsp; &nbsp; &nbsp;status_of_proc -p /var/run/$NAME.pid &quot;$DAEMON&quot; nginx &amp;&amp; exit 0 || exit $?<br />&nbsp;&nbsp; &nbsp; &nbsp;;;<br />&nbsp; *)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;N=/etc/init.d/$NAME<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;Usage: $N {start|stop|restart|reload|force-reload|status}&quot; &gt;&amp;2<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit 1<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />esac<br /><br />exit 0</div></div>
<p>$ sudo chmod +x /etc/init.d/nginx<br />
$ sudo /usr/sbin/update-rc.d -f nginx defaults</p>
<p>5. 启动、停止、重启nginx服务</p>
<div class="hl-surround"><div class="hl-main">sudo /etc/init.d/nginx start<br />sudo /etc/init.d/nginx stop<br />sudo /etc/init.d/nginx restart</div></div>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.444 seconds -->

