<?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; php</title>
	<atom:link href="http://www.linuxbyte.org/tag/php/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>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>PHP 5.3.4 发布</title>
		<link>http://www.linuxbyte.org/php-5-3-4-fa-bu.html</link>
		<comments>http://www.linuxbyte.org/php-5-3-4-fa-bu.html#comments</comments>
		<pubDate>Sat, 11 Dec 2010 12:59:42 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[新闻评论]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=577</guid>
		<description><![CDATA[OSMSG.com 消息 “PHP开发团队宣布PHP 5.3.4发布。新版增加对zip流的统计支持。新增follow_location(默认启用)支持。增加一个3rd parameter to get_html_translation_table。Multiple improvements to the FPM SAPI。修复100多... ]]></description>
			<content:encoded><![CDATA[<p>OSMSG.com 消息<br />
“PHP开发团队宣布PHP 5.3.4发布。新版增加对zip流的统计支持。新增follow_location(默认启用)支持。增加一个3rd parameter to get_html_translation_table。Multiple improvements to the FPM SAPI。修复100多出bug。”<br />
此前一天，PHP发布了5.2.15版，表示5.2.15代表对PHP 5.2分支支持的结束，它鼓励所有PHP 5.2用户升级到PHP 5.3.<span id="more-577"></span></p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><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/tui-jian-ge-php-bian-ji-qi-gphpedit.html" title="推荐个PHP 编辑器 Gphpedit">推荐个PHP 编辑器 Gphpedit</a></li><li><a href="http://www.linuxbyte.org/centos5-apache2-php5-tomcat6-jdk.html" title="Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装 ">Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装 </a></li><li><a href="http://www.linuxbyte.org/tips-for-apache-php-security.html" title="apache,php安全小技巧">apache,php安全小技巧</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2010<br />
Source: <a href="http://www.linuxbyte.org/php-5-3-4-fa-bu.html">PHP 5.3.4 发布</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/php" rel="tag">php</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/php" title="php" rel="tag">php</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/php-5-3-4-fa-bu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>推荐个PHP 编辑器 Gphpedit</title>
		<link>http://www.linuxbyte.org/tui-jian-ge-php-bian-ji-qi-gphpedit.html</link>
		<comments>http://www.linuxbyte.org/tui-jian-ge-php-bian-ji-qi-gphpedit.html#comments</comments>
		<pubDate>Fri, 23 Apr 2010 09:18:20 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[日常桌面]]></category>
		<category><![CDATA[gphpedit]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=538</guid>
		<description><![CDATA[这两天又在折腾Wordpress 的主题，本来一直用vim 的，但总觉得的不顺手，最终找来找去找到了Gphpedit。Gphpedit 是gnome 环境下的php 开发工具，支持php/html/xhtml,css,sql 等代码高亮，还提供PHP/CSS的代码... ]]></description>
			<content:encoded><![CDATA[<p>这两天又在折腾Wordpress 的主题，本来一直用vim 的，但总觉得的不顺手，最终找来找去找到了Gphpedit。Gphpedit 是gnome 环境下的php 开发工具，支持php/html/xhtml,css,sql 等代码高亮，还提供PHP/CSS的代码导航语法检查等<span id="more-538"></span>，不过相比vim 我最喜欢的是界面，简单而不失实用（好五毛的用词啊）。<br />
Ubuntu下安装gphpedit：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> gphpedit php5-cli</pre></div></div>

<p><a href="http://www.linuxbyte.org/uploads/2010/04/gphpedit.gif" rel="lightbox[538]"><img src="http://www.linuxbyte.org/uploads/2010/04/gphpedit-295x240.gif" alt="" title="gphpedit" width="295" height="240" class="alignnone size-medium wp-image-539" /></a></p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><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/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/centos5-apache2-php5-tomcat6-jdk.html" title="Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装 ">Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装 </a></li><li><a href="http://www.linuxbyte.org/tips-for-apache-php-security.html" title="apache,php安全小技巧">apache,php安全小技巧</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2010<br />
Source: <a href="http://www.linuxbyte.org/tui-jian-ge-php-bian-ji-qi-gphpedit.html">推荐个PHP 编辑器 Gphpedit</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/gphpedit" rel="tag">gphpedit</a>, <a href="http://www.linuxbyte.org/tag/php" rel="tag">php</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/gphpedit" title="gphpedit" rel="tag">gphpedit</a>, <a href="http://www.linuxbyte.org/tag/php" title="php" rel="tag">php</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/tui-jian-ge-php-bian-ji-qi-gphpedit.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装</title>
		<link>http://www.linuxbyte.org/centos5-apache2-php5-tomcat6-jdk.html</link>
		<comments>http://www.linuxbyte.org/centos5-apache2-php5-tomcat6-jdk.html#comments</comments>
		<pubDate>Sat, 08 Mar 2008 04:34:06 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/centos5-apache2-php5-tomcat6-jdk</guid>
		<description><![CDATA[ 安装步骤: jdk-6u3-linux-i586.bin #chmod u+x jdk-6u3-linux-i586.bin #./jdk-6u3-linux-i586.bin ln -s /usr/local/jdk1.6.0_03 /usr/local/jdk ln -s /usr/local/jdk1.6.0_03 /jre /usr/local/jre #vi /etc/profile 加入以下几行 export JAVA_HOME=/usr/loca... ]]></description>
			<content:encoded><![CDATA[<p> 安装步骤:<br />
jdk-6u3-linux-i586.bin</p>
<p>#chmod u+x jdk-6u3-linux-i586.bin<br />
#./jdk-6u3-linux-i586.bin<br />
<span id="more-69"></span><br />
ln -s /usr/local/jdk1.6.0_03 /usr/local/jdk<br />
ln -s /usr/local/jdk1.6.0_03 /jre /usr/local/jre<br />
#vi /etc/profile<br />
加入以下几行<br />
export JAVA_HOME=/usr/local/jdk<br />
export CLASSPATH=$JAVA_HOME/lib<br />
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH<br />
export CATALINA_HOME=/usr/local/tomcat<br />
保存退出。<br />
#source /etc/profile<br />
java –version 查看jdk是否安装成功<br />
httpd-2.2.6.tar.gz<br />
#cp httpd-2.2.6.tar.gz /usr/local<br />
#cd /usr/local<br />
#tar zxvf httpd-2.2.6.tar.gz<br />
#cd httpd-2.2.6<br />
#./configure –prefix=/usr/local/apache &#8211;enable-module=so<br />
#make<br />
#make install<br />
启动Apache，并测试。<br />
# cd /usr/local/apache/bin<br />
# ./apachectl start<br />
打开浏览器，并在地址栏中输入主机的IP地址<br />
apache-tomcat-6.0.14.tar.gz<br />
#tar zxvf apache-tomcat-6.0.14.tar.gz<br />
#cp –r apache-tomcat-6.0.14 /usr/local/tomcat<br />
#/usr/local/tomcat/bin/startup.sh<br />
打开<br />
<a target="_blank" href="http://localhost:8080/"><font color="#0000ff">http://localhost:8080</font></a><br />
验证tomcat可以启动<br />
整和apache和tomcat<br />
tomcat-connectors-1.2.25-src.tar.gz<br />
#tar zxvf tomcat-connectors-1.2.25-src.tar.gz<br />
进行编译配置。大家一定要注意这几个参数中前三个是很重要的，必要时可以去相应的目录看看相关的文件是否存在。<br />
#cd tomcat-connectors-1.2.25-src/native<br />
# ./ buildconf.sh<br />
#./configure &#8211;with-apxs=/usr/local/apache/bin/apxs  &#8211;with-tomcat=/usr/local/tomcat &#8211;with-java-home=/usr/java/jdk &#8211;with-jni<br />
# make<br />
# make install<br />
#ll /usr/local/apache/modules/mod_jk.so<br />
-rwxr-xr-x  1 root root 487769  8月 14 20:40 /usr/local/apache/modules/mod_jk.so<br />
mod_jk.so生成成功了。<br />
编辑apache的配置文件：<br />
#vi /usr/local/apache/conf/httpd.conf<br />
在末尾添加以下几行<br />
# Load mod_jk module<br />
  LoadModule jk_module modules/mod_jk.so<br />
# Where to find workers.properties<br />
  JkWorkersFile     /usr/local/apache/conf/workers.properties<br />
# Where to put jk logs<br />
  JkLogFile     /usr/local/apache/logs/mod_jk.log</p>
<p># Set the jk log level [debug/error/info]<br />
JkLogLevel    info</p>
<p># Select the timestamp log format<br />
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”</p>
<p># JkRequestLogFormat set the request format<br />
JkRequestLogFormat “%w %V %T”</p>
<p># JkOptions indicate to send SSL KEY SIZE,<br />
JkOptions  +ForwardKeySize +ForwardURICompat -ForwardDirectories</p>
<p># Send servlet for context /examples to worker named worker1<br />
#JkMount  /examples/*.jsp worker1<br />
  JkMount  /servlet/* worker1</p>
<p># Send JSPs  for context /examples to worker named worker1<br />
  JkMount  /*.jsp worker1</p>
<p>创建文件workers.proferties<br />
#vi /usr/local/apache/conf/workers.porperties<br />
添加如下内容：<br />
    workers.tomcat_home=/usr/local/tomcat<br />
    workers.java_home=/usr/local/jdk<br />
    ps=/<br />
    worker.list=worker1<br />
    worker.worker1.port=8009<br />
    worker.worker1.host=localhost<br />
    worker.worker1.type=ajp13<br />
    worker.worker1.connection_pool_timeout=600<br />
    worker.worker1.socket_keepalive=1<br />
    worker.worker1.lbfactor=1<br />
    worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout<br />
    worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr<br />
5)   配置apache和tomcat的虚拟主机<br />
首先APACHE的虚拟主机设置如下：<br />
修改 conf/httpd.conf找到<br />
# Virtual hosts<br />
#Include conf/extra/httpd-vhosts.conf<br />
修改为<br />
# Virtual hosts<br />
Include conf/extra/httpd-vhosts.conf<br />
然后编辑<br />
conf/extra/httpd-vhosts.conf<br />
加入下面的代码<br />
    ServerAdmin oasis.yan@intermobiz.com<br />
    DocumentRoot /data/www/test1<br />
    ServerName test1.ydjxc.com<br />
    DirectoryIndex  index.jsp   <br />
    ErrorLog logs/web_error_log<br />
    CustomLog logs/web_access_log common<br />
  Options -Indexes FollowSymLinks<br />
  AllowOverride None<br />
  Order allow,deny<br />
  Allow from all</p>
<p>    ServerAdmin oasis.yan@intermobiz.com<br />
    DocumentRoot /data/www/test2<br />
    ServerName test2.ydjxc.com<br />
    ServerAlias localhost<br />
    DirectoryIndex  index.jsp<br />
    ErrorLog logs/wap_error_log<br />
    CustomLog logs/wap_access_log common<br />
  Options -Indexes FollowSymLinks<br />
  AllowOverride None<br />
  Order allow,deny<br />
  Allow from all<br />
备注：test1/index.jsp的内容如下：</p>
<p>同理为test2/index.jsp<br />
注意：丢掉下面这段代码会提示403错误<br />
  Options -Indexes FollowSymLinks<br />
  AllowOverride None<br />
  Order allow,deny<br />
  Allow from all</p>
<p>其次Tomcat设置虚拟主机<br />
编辑tomcat的配置文件server.xml<br />
在后面添加如下代码</p>
<p>备注：其中这是两段虚拟主机的代码，红色部分为虚拟目录的配置，这样就可以访问<br />
<a target="_blank" href="http://test1.ydjxc.com:8080/test2"><font color="#0000ff">http://test1.ydjxc.com:8080/test2</font></a><br />
<a target="_blank" href="http://test2.ydjxc.com:8080/test1"><font color="#0000ff">http://test2.ydjxc.com:8080/test1</font></a><br />
特别注意的地方:<br />
在配置文件中找到：<br />
讲其改为：<br />
如果不改的话，输入：<br />
<a target="_blank" href="http://ip:8080/"><font color="#0000ff">http://ip:8080</font></a><br />
就可以直接进入tomcat的管理界面了。<br />
最后重新启动tomcat和apache，我们的安装就完成了<br />
#/usr/local/tomcat/bin/shutdown.sh    //关闭tomcat<br />
#/usr/local/tomcat/bin/startup.sh     //启动tomcat<br />
#/usr/local/apache/bin/apachectl restart    //重启apache<br />
参考地址<br />
<a target="_blank" href="http://www.rssday.com/article/id-477.html"><font color="#0000ff">http://www.rssday.com/article/id-477.html</font></a></p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/tips-for-apache-php-security.html" title="apache,php安全小技巧">apache,php安全小技巧</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/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/tui-jian-ge-php-bian-ji-qi-gphpedit.html" title="推荐个PHP 编辑器 Gphpedit">推荐个PHP 编辑器 Gphpedit</a></li><li><a href="http://www.linuxbyte.org/centos5-peizh-dhcp.html" title="centos5 下配置 DHCP 服务器">centos5 下配置 DHCP 服务器</a></li><li><a href="http://www.linuxbyte.org/apache-license-version-2.html" title="Apache License Version 2.0">Apache License Version 2.0</a></li><li><a href="http://www.linuxbyte.org/config-apache-mod_limitipconn.html" title="apache 下限制单个IP 的并发连接数">apache 下限制单个IP 的并发连接数</a></li><li><a href="http://www.linuxbyte.org/apache-url-rewrite.html" title="Apache Url Rewrite(mod_rewrite)">Apache Url Rewrite(mod_rewrite)</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/centos5-apache2-php5-tomcat6-jdk.html">Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/apache" rel="tag">apache</a>, <a href="http://www.linuxbyte.org/tag/centos" rel="tag">Centos</a>, <a href="http://www.linuxbyte.org/tag/jdk" rel="tag">jdk</a>, <a href="http://www.linuxbyte.org/tag/php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/tomcat" rel="tag">tomcat</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/apache" title="apache" rel="tag">apache</a>, <a href="http://www.linuxbyte.org/tag/centos" title="Centos" rel="tag">Centos</a>, <a href="http://www.linuxbyte.org/tag/jdk" title="jdk" rel="tag">jdk</a>, <a href="http://www.linuxbyte.org/tag/php" title="php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/tomcat" title="tomcat" rel="tag">tomcat</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/centos5-apache2-php5-tomcat6-jdk.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache,php安全小技巧</title>
		<link>http://www.linuxbyte.org/tips-for-apache-php-security.html</link>
		<comments>http://www.linuxbyte.org/tips-for-apache-php-security.html#comments</comments>
		<pubDate>Thu, 28 Feb 2008 07:11:23 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[系统网络安全]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/tips-for-apache-php-security</guid>
		<description><![CDATA[最简单的安全技巧，隐藏apache，php 的版本信息 Apache: 打开 httpd.conf，加入以下两行: ServerTokens ProductOnly ServerSignature Off PHP: 打开 php.ini，加入: expose_php = Off 完成以上两个设定后，重新启动 Apache ... ]]></description>
			<content:encoded><![CDATA[<p>最简单的安全技巧，隐藏apache，php 的版本信息</p>
<p><strong>Apache:</strong><br />
打开 httpd.conf，加入以下两行:</p>
<p>ServerTokens ProductOnly<br />
ServerSignature Off</p>
<p><strong>PHP:</strong><br />
打开 php.ini，加入:<span id="more-47"></span></p>
<p>expose_php = Off</p>
<p>完成以上两个设定后，重新启动 Apache 即可。</p>
<p>这个是最水货的安全措施了，另外apache 还可以改改源码把版本信息改为IIS<br />
编辑apache 源码目录下 /include/ap_release.h 文件<br />
参照下面代码修改</p>
<p>#define AP_SERVER_BASEVENDOR “这里填写开发组织名，例如：Microsoft Corp.”<br />
#define AP_SERVER_BASEPRODUCT “这里填写服务器软件名，例如:Microsoft-IIS”<br />
#define AP_SERVER_MAJORVERSION “主版本，例如：5&#8243;<br />
#define AP_SERVER_MINORVERSION “次版本，例如：0&#8243;<br />
#define AP_SERVER_PATCHLEVEL “修正版本，例如：1&#8243;</p>
<p>打开/include/os.h 文件,修改下面例句中的代码</p>
<p>#define PLATFORM “这里填写操作系统的名称，例如：Winnt”</p>
<p>打开文件 /os/PLATFORM/os.h ，修改</p>
<p>#define PLATFORM “这里填写操作系统的名称，例如：Winnt”</p>
<p>打开文件 /modules/generators/mod_info.c  修改</p>
<p>Search “Apache Server Information” replace with “这里填写在查看server-info现实的页面标题，例如:Microsoft-IIS Information”</p>
<p>打开文件 /modules/generators/mod_status.c 修改</p>
<p>Search “Apache Server Status” replace with “这里填写在查看server-status现实的页面标题，例如:Microsoft-IIS Status”</p>
<p>然后重新编译安装apache。</p>
<p>其实上面都是忽悠菜鸟用的，apache 中有一个modsecurity 对提升apache 的安全很有用，经过多年的发展功能已经非常强大，我个人最喜欢它对SQL注入的防护。另外 SE_linux 也是非常不错安全工具，不过这个东西配置起来比较麻烦，中文的文档也不多。</p>
<p><strong>最基本的php的安全设置</strong></p>
<p>disable_functions = phpinfo, get_cfg_var<br />
display_errors = Off<br />
allow_url_fopen = Off<br />
safe_mode = On</p>
<p>open_basedir = /usr/local/httpd/htdocs/dir1:/usr/local/httpd/htdocs/dir2<br />
#目录权限控制，dir1中的php程序就无法访问dir2中的内容。反过来也不行</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/centos5-apache2-php5-tomcat6-jdk.html" title="Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装 ">Centos5+Apache2.2.6+PHP5+tomcat6.0.14+jdk1.6整合安装 </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/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/tui-jian-ge-php-bian-ji-qi-gphpedit.html" title="推荐个PHP 编辑器 Gphpedit">推荐个PHP 编辑器 Gphpedit</a></li><li><a href="http://www.linuxbyte.org/apache-license-version-2.html" title="Apache License Version 2.0">Apache License Version 2.0</a></li><li><a href="http://www.linuxbyte.org/config-apache-mod_limitipconn.html" title="apache 下限制单个IP 的并发连接数">apache 下限制单个IP 的并发连接数</a></li><li><a href="http://www.linuxbyte.org/apache-url-rewrite.html" title="Apache Url Rewrite(mod_rewrite)">Apache Url Rewrite(mod_rewrite)</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/tips-for-apache-php-security.html">apache,php安全小技巧</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/apache" rel="tag">apache</a>, <a href="http://www.linuxbyte.org/tag/php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/security" rel="tag">系统网络安全</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/apache" title="apache" rel="tag">apache</a>, <a href="http://www.linuxbyte.org/tag/php" title="php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/security" 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/tips-for-apache-php-security.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

