<?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/"
	>

<channel>
	<title>LinuxByte &#187; nginx</title>
	<atom:link href="http://www.linuxbyte.org/tag/nginx/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxbyte.org</link>
	<description>一个Linux Blog</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:13:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>用 awstats分析 Nginx 日志的一些记录</title>
		<link>http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html</link>
		<comments>http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html#comments</comments>
		<pubDate>Wed, 27 Apr 2011 08:55:12 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[日志分析]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=701</guid>
		<description><![CDATA[系统环境为Cenots+Nginx 详细请阅读之前的日志《Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql》。 Awstats 是目前最流行的日志分析工具，它提供比第三方日志更方便更详实的日志分析。 系统默认Nginx 版... ]]></description>
			<content:encoded><![CDATA[<p>系统环境为Cenots+Nginx 详细请阅读之前的日志《<a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a>》。<br />
Awstats 是目前最流行的日志分析工具，它提供比第三方日志更方便更详实的日志分析。<br />
<span id="more-701"></span><br />
系统默认Nginx 版本为 1.0.0，日志格式 Awstats 可以直接识别，并且由logrotate 做了日志回滚，每日对日志进行截断。为了得到更准确的分析结果并且尽量少占用系统资源，我每天在凌晨分析上一天的日志，并将结果输出为纯静态文件。由于logrotate 压缩了旧日志所以要修改logrotate 设置不压缩就日志。<br />
修改vi /etc/logrotate.d/nginx</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">/var/log/nginx/*log {
    daily
    rotate 10 #保留10天的日志
    missingok
    notifempty
    nocompress #就是这里默认是compress压缩日志
    sharedscripts
    postrotate
        [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
    endscript
}</pre></div></div>

<p>下载安装Awstats</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>prdownloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>awstats-<span style="color: #000000;">7.0</span>-<span style="color: #000000;">1</span>.noarch.rpm
rpm <span style="color: #660033;">-ivh</span> awstats-<span style="color: #000000;">7.0</span>-<span style="color: #000000;">1</span>.noarch.rpm</pre></div></div>

<p>配置</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>tools
<span style="color: #c20cb9; font-weight: bold;">perl</span> awstats_configure.pl</pre></div></div>

<p>由于我们的web服务器是Nginx 所以 Check for web server install 我们选 none</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">-----&gt; Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y #这里选Y
&nbsp;
-----&gt; Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
&gt; www.linuxbyte.org #输入你要统计的网站的域名</pre></div></div>

<p>编辑/etc/awstats/awstats.www.linuxbyte.org.conf<br />
修改 LogFile 段加入网站日志的路径。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">LogFile=&quot;/var/log/nginx/www.linuxbyte.org.access.log.1&quot;</pre></div></div>

<p>生成份分析结果的静态文件</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>linuxbyte.org<span style="color: #000000; font-weight: bold;">/</span>awstats
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>wwwroot<span style="color: #000000; font-weight: bold;">/</span>icon<span style="color: #000000; font-weight: bold;">/</span> .<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-rf</span> 
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>awstats_buildstaticpages.pl <span style="color: #660033;">-config</span>=www.linuxbyte.org <span style="color: #660033;">-lang</span>=cn <span style="color: #660033;">-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>linuxbyte<span style="color: #000000; font-weight: bold;">/</span>awstats <span style="color: #660033;">-update</span></pre></div></div>

<p>自此你可以访问http://www.linuxbyte.org/awstats/awstats.www.linuxbyte.org.html 来查看分析结果。</p>
<p>设置crontable</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">30 4 * * */usr/local/awstats/tools/awstats_buildstaticpages.pl -config=www.linuxbyte.org -lang=cn -dir=/web/linuxbyte/awstats -update</pre></div></div>

<p>每天凌晨 4：30 分析日志，因为这个时候是服务器最空闲的时段。</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/shi-yong-awstats-hou-de-yi-xie-xiao-xiu-gai.html" title="使用 Awstats 后的一些小修改">使用 Awstats 后的一些小修改</a></li><li><a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html" title="Nginx 限制并发连接数">Nginx 限制并发连接数</a></li><li><a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html" title="Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a></li><li><a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html" title="Nginx下实现gzip静态文件压缩">Nginx下实现gzip静态文件压缩</a></li><li><a href="http://www.linuxbyte.org/nginx-install.html" title="Nginx 安装">Nginx 安装</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html">用 awstats分析 Nginx 日志的一些记录</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/awstats" rel="tag">awstats</a>, <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e6%97%a5%e5%bf%97%e5%88%86%e6%9e%90" rel="tag">日志分析</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/awstats" title="awstats" rel="tag">awstats</a>, <a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e6%97%a5%e5%bf%97%e5%88%86%e6%9e%90" title="日志分析" rel="tag">日志分析</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx 限制并发连接数</title>
		<link>http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html</link>
		<comments>http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html#comments</comments>
		<pubDate>Sat, 26 Mar 2011 15:23:29 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[并发连接数]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=671</guid>
		<description><![CDATA[在http 段添加下面语句定义一个记录区 limit_zone myzone $binary_remote_addr 10m; 在server 段加入下面语句，限制并发数为十。 limit_conn myzone 10; 与本文关系暧昧的文字用 awstats分析 Nginx 日志的一些记录Cent... ]]></description>
			<content:encoded><![CDATA[<p>在http 段添加下面语句定义一个记录区</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  limit_zone   myzone  $binary_remote_addr  10m;</pre></div></div>

<p>在server 段加入下面语句，限制并发数为十。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    limit_conn   myzone  10;</pre></div></div>

<p><span id="more-671"></span></p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html" title="用 awstats分析 Nginx 日志的一些记录">用 awstats分析 Nginx 日志的一些记录</a></li><li><a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html" title="Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a></li><li><a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html" title="Nginx下实现gzip静态文件压缩">Nginx下实现gzip静态文件压缩</a></li><li><a href="http://www.linuxbyte.org/nginx-install.html" title="Nginx 安装">Nginx 安装</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html">Nginx 限制并发连接数</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e5%b9%b6%e5%8f%91%e8%bf%9e%e6%8e%a5%e6%95%b0" rel="tag">并发连接数</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e5%b9%b6%e5%8f%91%e8%bf%9e%e6%8e%a5%e6%95%b0" title="并发连接数" rel="tag">并发连接数</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</title>
		<link>http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html</link>
		<comments>http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html#comments</comments>
		<pubDate>Tue, 22 Mar 2011 06:59:53 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[eaccelerator]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=662</guid>
		<description><![CDATA[记录下我在linodeVPS 的Centos下安装配置nginx+PHP-FPM+eAccelerator+mysql的过程。 添加安装源 Centos 默认官方源中没有nginx 和 php-fpm 所以必须添加第三方源，不然就只能自己编译了。 添加[CentALT]源 在/etc/y... ]]></description>
			<content:encoded><![CDATA[<p>记录下我在<a href="http://www.linode.com/?r=558aa1aed383ae43555fab01b4c51359f6035a97">linode</a>VPS 的Centos下安装配置nginx+PHP-FPM+eAccelerator+mysql的过程。</p>
<p><strong>添加安装源</strong><br />
Centos 默认官方源中没有nginx 和 php-fpm 所以必须添加第三方源，不然就只能自己编译了。<br />
<span id="more-662"></span><br />
添加[CentALT]源<br />
在/etc/yum.repo.d 目下创建 alt.ru.repo 文件内容如下：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">[CentALT]
name=CentALT Packages for Enterprise Linux 5 - $basearch
baseurl=http://centos.alt.ru/repository/centos/5/$basearch/
enabled=1
gpgcheck=0</pre></div></div>

<p>启用 EPEL</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-Uvh</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>x86_64<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">5</span>-<span style="color: #000000;">4</span>.noarch.rpm</pre></div></div>

<p>32系统的用下面命令</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm -Uvhhttp:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>i386<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">5</span>-<span style="color: #000000;">4</span>.noarch.rpm</pre></div></div>

<p><strong>安装 nginx +PHP-FPM +eAccelerator +mysql</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum update
 yum <span style="color: #c20cb9; font-weight: bold;">install</span> nginx php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator</pre></div></div>

<p><strong>配置优化Nginx</strong><br />
修改 /etc/nginx/nginx.conf,下面只列出修改的部分。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">#根据CPU 核心processes，VPS下几个核心几个processes，独立服务器可x2
worker_processes  4;
&nbsp;
#启用epoll
worker_rlimit_nofile 51200;
events {
    worker_connections  51200;
    use epoll;
}
#参数调整
    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;
    server_tokens   off;
    keepalive_timeout  50;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 50m;
#fastcgi优化
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;
&nbsp;
#开启gzip并优化
    gzip on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;</pre></div></div>

<p><strong>php-fpm 调整</strong><br />
修改/etc/php-fpm.conf 将max_children 调为20</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;max_children&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>20<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><strong>mysql 调整</strong><br />
修改/etc/my.conf [mysqld] 段加入如下指令</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">skip-network
skip-innodb
skip-locking
skip-bdb
&nbsp;
key_buffer              = 16K
max_allowed_packet      = 3M
thread_stack            = 64K
thread_cache_size       = 8
table_cache             = 3
query_cache_limit       = 1M
query_cache_size        = 16M</pre></div></div>

<p><strong>系统内核调整</strong><br />
在/etc/sysctl.conf 加入</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 5000    65000
net.ipv4.tcp_max_tw_buckets = 6000</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> “<span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-SHn</span> <span style="color: #000000;">65535</span>” <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.local
styctl <span style="color: #660033;">-p</span></pre></div></div>

<p>开启服务并设置系统启动默认启动</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-SHn</span> <span style="color: #000000;">65535</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nginx  start
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>php-fpm start
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysqld start
chkconfig nginx on
chkconfig php-fpm on
chkconfig mysqld on</pre></div></div>

<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html" title="用 awstats分析 Nginx 日志的一些记录">用 awstats分析 Nginx 日志的一些记录</a></li><li><a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html" title="Nginx 限制并发连接数">Nginx 限制并发连接数</a></li><li><a href="http://www.linuxbyte.org/php-5-3-4-fa-bu.html" title="PHP 5.3.4 发布 ">PHP 5.3.4 发布 </a></li><li><a href="http://www.linuxbyte.org/mysql-slave-pei-zhi-bei-fen.html" title="mysql slave 配置备份">mysql slave 配置备份</a></li><li><a href="http://www.linuxbyte.org/my-cnf-master.html" title="mysql master 配置备份">mysql master 配置备份</a></li><li><a href="http://www.linuxbyte.org/yi-ge-mysql-server-shang-de-xiao-ji-qiao.html" title="一个 mysql server 上的小技巧">一个 mysql server 上的小技巧</a></li><li><a href="http://www.linuxbyte.org/tui-jian-ge-php-bian-ji-qi-gphpedit.html" title="推荐个PHP 编辑器 Gphpedit">推荐个PHP 编辑器 Gphpedit</a></li><li><a href="http://www.linuxbyte.org/centos-xia-an-zhuang-pei-zhi-powerdns.html" title="Centos 下安装配置 PowerDNS ">Centos 下安装配置 PowerDNS </a></li><li><a href="http://www.linuxbyte.org/jia-gu-wen-xiang-mysqlyong-hu-kai-fa-zhe-he-ke-hu-de-shi-xiang-cheng-nuo.html" title="甲骨文向MySQL用户、开发者和客户的十项承诺">甲骨文向MySQL用户、开发者和客户的十项承诺</a></li><li><a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html" title="Nginx下实现gzip静态文件压缩">Nginx下实现gzip静态文件压缩</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/eaccelerator" rel="tag">eaccelerator</a>, <a href="http://www.linuxbyte.org/tag/mysql" rel="tag">mysql</a>, <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/php-fpm" rel="tag">php-fpm</a>, <a href="http://www.linuxbyte.org/tag/yum" rel="tag">yum</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/eaccelerator" title="eaccelerator" rel="tag">eaccelerator</a>, <a href="http://www.linuxbyte.org/tag/mysql" title="mysql" rel="tag">mysql</a>, <a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/php" title="php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/php-fpm" title="php-fpm" rel="tag">php-fpm</a>, <a href="http://www.linuxbyte.org/tag/yum" title="yum" rel="tag">yum</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Nginx下实现gzip静态文件压缩</title>
		<link>http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html</link>
		<comments>http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html#comments</comments>
		<pubDate>Wed, 04 Feb 2009 12:25:35 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=366</guid>
		<description><![CDATA[别地方抄来的留个备份 nginx要修改两处，在虚拟主机配置段中添加： location ~* ^.+.gzjs$ &#123; add_header Content-Encoding gzip; gzip off; &#125; 另外再修改nginx的mime文件，在application/x-javascript js;中添加gzjs ap... ]]></description>
			<content:encoded><![CDATA[<p>别地方抄来的留个备份<br />
nginx要修改两处，在虚拟主机配置段中添加：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">location ~<span style="color: #000000; font-weight: bold;">*</span> ^.+.gzjs$ <span style="color: #7a0874; font-weight: bold;">&#123;</span>
add_header Content-Encoding <span style="color: #c20cb9; font-weight: bold;">gzip</span>;
<span style="color: #c20cb9; font-weight: bold;">gzip</span> off;
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>另外再修改nginx的mime文件，在application/x-javascript js;中添加gzjs</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">application<span style="color: #000000; font-weight: bold;">/</span>x-javascript js gzjs;</pre></div></div>

<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html" title="用 awstats分析 Nginx 日志的一些记录">用 awstats分析 Nginx 日志的一些记录</a></li><li><a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html" title="Nginx 限制并发连接数">Nginx 限制并发连接数</a></li><li><a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html" title="Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a></li><li><a href="http://www.linuxbyte.org/nginx-install.html" title="Nginx 安装">Nginx 安装</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2009<br />
Source: <a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html">Nginx下实现gzip静态文件压缩</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/gzip" rel="tag">gzip</a>, <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/gzip" title="gzip" rel="tag">gzip</a>, <a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx 安装</title>
		<link>http://www.linuxbyte.org/nginx-install.html</link>
		<comments>http://www.linuxbyte.org/nginx-install.html#comments</comments>
		<pubDate>Tue, 12 Feb 2008 07:13:18 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/nginx-install</guid>
		<description><![CDATA[Nginx在一些Linux发行版和BSD的各个变种版本的安装包仓库中都会有，通过各个系统自带的软件包管理方法即可安装。需要注意的是，很多预先编译好的安装包都比较陈旧，大多数情况下还是推荐... ]]></description>
			<content:encoded><![CDATA[<p>预先编译好的安装包<br />
Nginx在一些Linux发行版和BSD的各个变种版本的安装包仓库中都会有，通过各个系统自带的软件包管理方法即可安装。需要注意的是，很多预先编译好的安装包都比较陈旧，大多数情况下还是推荐直接从源码编译。</p>
<p>官方源代码下载<br />
<a href="http://sysoev.ru/nginx/download.html">http://sysoev.ru/nginx/download.html</a><br />
<span id="more-4"></span></p>
<p>使用源代码进行构建<br />
Nginx 使用 Unix 下常用的 &#8216;./configure &amp;&amp; make &amp;&amp; make install&#8217; 过程来编译安装。</p>
<p>configure 脚本确定系统所具有一些特性，特别是 nginx 用来处理连接的方法。然后，它创建 Makefile 文件。</p>
<p>configure 支持下面的选项：</p>
<p>&#8211;prefix=&lt;path&gt; &#8211; Nginx安装路径。如果没有指定，默认为 /usr/local/nginx。</p>
<p>&#8211;sbin-path=&lt;path&gt; &#8211; Nginx可执行文件安装路径。只能安装时指定，如果没有指定，默认为&lt;prefix&gt;/sbin/nginx。</p>
<p>&#8211;conf-path=&lt;path&gt; &#8211; 在没有给定-c选项下默认的nginx.conf的路径。如果没有指定，默认为&lt;prefix&gt;/conf/nginx.conf。</p>
<p>&#8211;pid-path=&lt;path&gt; &#8211; 在nginx.conf中没有指定pid指令的情况下，默认的nginx.pid的路径。如果没有指定，默认为 &lt;prefix&gt;/logs/nginx.pid。</p>
<p>&#8211;lock-path=&lt;path&gt; &#8211; nginx.lock文件的路径。</p>
<p>&#8211;error-log-path=&lt;path&gt; &#8211; 在nginx.conf中没有指定error_log指令的情况下，默认的错误日志的路径。如果没有指定，默认为 &lt;prefix&gt;/logs/error.log。</p>
<p>&#8211;http-log-path=&lt;path&gt; &#8211; 在nginx.conf中没有指定access_log指令的情况下，默认的访问日志的路径。如果没有指定，默认为 &lt;prefix&gt;/logs/access.log。</p>
<p>&#8211;user=&lt;user&gt; &#8211; 在nginx.conf中没有指定user指令的情况下，默认的nginx使用的用户。如果没有指定，默认为 nobody。</p>
<p>&#8211;group=&lt;group&gt; &#8211; 在nginx.conf中没有指定user指令的情况下，默认的nginx使用的组。如果没有指定，默认为 nobody。</p>
<p>&#8211;builddir=DIR &#8211; 指定编译的目录</p>
<p>&#8211;with-rtsig_module &#8211; 启用 rtsig 模块</p>
<p>&#8211;with-select_module &#8211;without-select_module &#8211; Whether or not to enable the select module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.</p>
<p>//允许或不允许开启SELECT模式，如果 configure 没有找到更合适的模式，比如：kqueue(sun os),epoll (linux kenel 2.6+), rtsig(实时信号)或者/dev/poll(一种类似select的模式，底层实现与SELECT基本相 同，都是采用轮训方法) SELECT模式将是默认安装模式</p>
<p>&#8211;with-poll_module &#8211;without-poll_module &#8211; Whether or not to enable the poll module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.</p>
<p>&#8211;with-http_ssl_module &#8211; Enable ngx_http_ssl_module. Enables SSL support and the ability to handle HTTPS requests. Requires OpenSSL. On Debian, this is libssl-dev.</p>
<p>//开启HTTP SSL模块，使NGINX可以支持HTTPS请求。这个模块需要已经安装了OPENSSL，在DEBIAN上是libssl</p>
<p>&#8211;with-http_realip_module &#8211; 启用 ngx_http_realip_module</p>
<p>&#8211;with-http_addition_module &#8211; 启用 ngx_http_addition_module</p>
<p>&#8211;with-http_sub_module &#8211; 启用 ngx_http_sub_module</p>
<p>&#8211;with-http_dav_module &#8211; 启用 ngx_http_dav_module</p>
<p>&#8211;with-http_flv_module &#8211; 启用 ngx_http_flv_module</p>
<p>&#8211;with-http_stub_status_module &#8211; 启用 “server status” 页</p>
<p>&#8211;without-http_charset_module &#8211; 禁用 ngx_http_charset_module</p>
<p>&#8211;without-http_gzip_module &#8211; 禁用 ngx_http_gzip_module. 如果启用，需要 zlib 。</p>
<p>&#8211;without-http_ssi_module &#8211; 禁用 ngx_http_ssi_module</p>
<p>&#8211;without-http_userid_module &#8211; 禁用 ngx_http_userid_module</p>
<p>&#8211;without-http_access_module &#8211; 禁用 ngx_http_access_module</p>
<p>&#8211;without-http_auth_basic_module &#8211; 禁用 ngx_http_auth_basic_module</p>
<p>&#8211;without-http_autoindex_module &#8211; 禁用 ngx_http_autoindex_module</p>
<p>&#8211;without-http_geo_module &#8211; 禁用 ngx_http_geo_module</p>
<p>&#8211;without-http_map_module &#8211; 禁用 ngx_http_map_module</p>
<p>&#8211;without-http_referer_module &#8211; 禁用 ngx_http_referer_module</p>
<p>&#8211;without-http_rewrite_module &#8211; 禁用 ngx_http_rewrite_module. 如果启用需要 PCRE 。</p>
<p>&#8211;without-http_proxy_module &#8211; 禁用 ngx_http_proxy_module</p>
<p>&#8211;without-http_fastcgi_module &#8211; 禁用 ngx_http_fastcgi_module</p>
<p>&#8211;without-http_memcached_module &#8211; 禁用 ngx_http_memcached_module</p>
<p>&#8211;without-http_limit_zone_module &#8211; 禁用 ngx_http_limit_zone_module</p>
<p>&#8211;without-http_empty_gif_module &#8211; 禁用 ngx_http_empty_gif_module</p>
<p>&#8211;without-http_browser_module &#8211; 禁用 ngx_http_browser_module</p>
<p>&#8211;without-http_upstream_ip_hash_module &#8211; 禁用 ngx_http_upstream_ip_hash_module</p>
<p>&#8211;with-http_perl_module &#8211; 启用 ngx_http_perl_module</p>
<p>&#8211;with-perl_modules_path=PATH &#8211; 指定 perl 模块的路径</p>
<p>&#8211;with-perl=PATH &#8211; 指定 perl 执行文件的路径</p>
<p>&#8211;http-log-path=PATH &#8211; Set path to the http access log</p>
<p>&#8211;http-client-body-temp-path=PATH &#8211; Set path to the http client request body temporary files</p>
<p>&#8211;http-proxy-temp-path=PATH &#8211; Set path to the http proxy temporary files</p>
<p>&#8211;http-fastcgi-temp-path=PATH &#8211; Set path to the http fastcgi temporary files</p>
<p>&#8211;without-http &#8211; 禁用 HTTP server</p>
<p>&#8211;with-mail &#8211; 启用 IMAP4/POP3/SMTP 代理模块</p>
<p>&#8211;with-mail_ssl_module &#8211; 启用 ngx_mail_ssl_module</p>
<p>&#8211;with-cc=PATH &#8211; 指定 C 编译器的路径</p>
<p>&#8211;with-cpp=PATH &#8211; 指定 C 预处理器的路径</p>
<p>&#8211;with-cc-opt=OPTIONS &#8211; Additional parameters which will be added to the variable CFLAGS. With the use of the system library PCRE in FreeBSD, it is necessary to indicate &#8211;with-cc-opt=”-I /usr/local/include”. If we are using select() and it is necessary to increase the number of file descriptors, then this also can be assigned here: &#8211;with-cc-opt=”-D FD_SETSIZE=2048&#8243;.</p>
<p>&#8211;with-ld-opt=OPTIONS &#8211; Additional parameters passed to the linker. With the use of the system library PCRE in FreeBSD, it is necessary to indicate &#8211;with-ld-opt=”-L /usr/local/lib”.</p>
<p>&#8211;with-cpu-opt=CPU &#8211; 为特定的 CPU 编译，有效的值包括：pentium, pentiumpro, pentium3, pentium4, athlon, opteron, amd64, sparc32, sparc64, ppc64</p>
<p>&#8211;without-pcre &#8211; 禁止 PCRE 库的使用。同时也会禁止 HTTP rewrite 模块。在 “location” 配置指令中的正则表达式也需要 PCRE 。</p>
<p>&#8211;with-pcre=DIR &#8211; 指定 PCRE 库的源代码的路径。</p>
<p>&#8211;with-pcre-opt=OPTIONS &#8211; Set additional options for PCRE building.</p>
<p>&#8211;with-md5=DIR &#8211; Set path to md5 library sources.</p>
<p>&#8211;with-md5-opt=OPTIONS &#8211; Set additional options for md5 building.</p>
<p>&#8211;with-md5-asm &#8211; Use md5 assembler sources.</p>
<p>&#8211;with-sha1=DIR &#8211; Set path to sha1 library sources.</p>
<p>&#8211;with-sha1-opt=OPTIONS &#8211; Set additional options for sha1 building.</p>
<p>&#8211;with-sha1-asm &#8211; Use sha1 assembler sources.</p>
<p>&#8211;with-zlib=DIR &#8211; Set path to zlib library sources.</p>
<p>&#8211;with-zlib-opt=OPTIONS &#8211; Set additional options for zlib building.</p>
<p>&#8211;with-zlib-asm=CPU &#8211; Use zlib assembler sources optimized for specified CPU, valid values are: pentium, pentiumpro</p>
<p>&#8211;with-openssl=DIR &#8211; Set path to OpenSSL library sources</p>
<p>&#8211;with-openssl-opt=OPTIONS &#8211; Set additional options for OpenSSL building</p>
<p>&#8211;with-debug &#8211; 启用调试日志</p>
<p>&#8211;add-module=PATH &#8211; Add in a third-party module found in directory PATH</p>
<p>在不同版本间，选项可能会有些许变化，请总是使用 ./configure &#8211;help 命令来检查一下当前的选项列表。</p>
<p>示例 (最好能在同一行)：<br />
    ./configure \<br />
        &#8211;sbin-path=/usr/local/nginx/nginx \<br />
        &#8211;conf-path=/usr/local/nginx/nginx.conf \<br />
        &#8211;pid-path=/usr/local/nginx/nginx.pid \<br />
        &#8211;with-http_ssl_module \<br />
        &#8211;with-pcre=../pcre-4.4 \<br />
        &#8211;with-zlib=../zlib-1.1.3<br />
Example on Ubuntu/debian with libgcrypt11-dev, libpcre3-dev and libssl-dev installed (choose EITHER &#8211;with-md5 OR &#8211;with-sha1, but not both; on debian and ubuntu, they should both point to /usr/lib)<br />
     ./configure &#8211;with-openssl=/usr/lib/ssl/ &#8211;with-md5=/usr/lib<br />
An Ubuntu Edgy .deb for version 0.5.2 can be found here: nginx_0.5.2-1_i386.deb.</p>
<p>(NOTE: According to an October 2006 message md5 was used in a now broken http cache module and sha1 is used in an incomplete mysql library module and so are currently not needed.)</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html" title="用 awstats分析 Nginx 日志的一些记录">用 awstats分析 Nginx 日志的一些记录</a></li><li><a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html" title="Nginx 限制并发连接数">Nginx 限制并发连接数</a></li><li><a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html" title="Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a></li><li><a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html" title="Nginx下实现gzip静态文件压缩">Nginx下实现gzip静态文件压缩</a></li><li><a href="http://www.linuxbyte.org/zhen-dui-webfu-wu-qi-zong-ti-you-hua.html" title="针对Web服务器总体优化">针对Web服务器总体优化</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2008<br />
Source: <a href="http://www.linuxbyte.org/nginx-install.html">Nginx 安装</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/web" rel="tag">web</a>, <a href="http://www.linuxbyte.org/tag/%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ba%94%e7%94%a8" rel="tag">服务器应用</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/web" title="web" rel="tag">web</a>, <a href="http://www.linuxbyte.org/tag/%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ba%94%e7%94%a8" title="服务器应用" rel="tag">服务器应用</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/nginx-install.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

