<?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>Life Style! &#187; lamp</title>
	<atom:link href="http://www.realqi.cn/tag/lamp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.realqi.cn</link>
	<description>系统管理  维护监控  简单生活</description>
	<lastBuildDate>Wed, 25 Aug 2010 14:41:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>APACHE配置虚拟主机的三种方法</title>
		<link>http://www.realqi.cn/2009/10/apache%e9%85%8d%e7%bd%ae%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%9a%84%e4%b8%89%e7%a7%8d%e6%96%b9%e6%b3%95/</link>
		<comments>http://www.realqi.cn/2009/10/apache%e9%85%8d%e7%bd%ae%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%9a%84%e4%b8%89%e7%a7%8d%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 05:54:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[运维监控]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[vhosts]]></category>

		<guid isPermaLink="false">http://realqi.cn/?p=456</guid>
		<description><![CDATA[    apache有三种配置虚拟主机的方法，分别是基于不同的端口，不同的IP，和基于不同的域名，这三种方法分别适合不同的场景，

     apache2.2以上建义虚拟主机的配置或是修改都在conf/extra/httpd-vhost.conf 文件里进行。然后去掉httpd.conf 里面的 #Include  conf/extra/httpd-vhosts.conf 这一行的注释("#" )
]]></description>
			<content:encoded><![CDATA[<p><strong>lamp的安装参考: <a href="http://realqi.cn/2009/09/%e5%ae%89%e8%a3%85lamp%e7%8e%af%e5%a2%83%e6%a0%87%e5%87%86%e7%89%88/">安装lamp</a></strong></p>
<p>    apache有三种配置虚拟主机的方法，分别是基于不同的端口，不同的IP，和基于不同的域名，这三种方法分别适合不同的场景，</p>
<p>     apache2.2以上建义虚拟主机的配置或是修改都在<strong>conf/extra/httpd-vhost.conf </strong>文件里进行。然后去掉httpd.conf 里面的 <strong>#Include </strong> <strong>conf/extra/httpd-vhosts.conf</strong> 这一行的注释("#" )</p>
<p>    针对apache配置文件的修改,都需要重启apache服务</p>
<p><strong>1.基于相同IP不同Port的虚拟主机</strong><br />
    更改虚拟主机配置,例如下:</p>
<pre>    Listen 80
    Listen 8888
&lt;VirtualHost *:80&gt;
    ServerAdmin <a href="mailto:cacti@realqi.cn">cacti@realqi.cn</a>
    DocumentRoot "/usr/local/apache2/htdocs/wordpress/"
    ServerName  develop.realqi.cn
    DirectoryIndex index.php
&lt;/VirtualHost&gt;
 
&lt;VirtualHost *:8888&gt;
    ServerAdmin <a href="mailto:cacti@realqi.cn">cacti@realqi.cn</a>
    DocumentRoot "/usr/local/apache2/htdocs/cms/wordpress"
    ServerName  cms.realqi.cn
&lt;/VirtualHost&gt;</pre>
<p>注意:相关的目录如"wordpress","../cms/wordpress" 必需存在.重启apache,就可生效.</p>
<p align="left"><strong>2.</strong><strong>基于相同</strong><strong>Port</strong><strong>不同</strong><strong>IP</strong><strong>的虚拟主机这种情况适合服务器有多个IP</strong></p>
<p align="left"><strong>      详细参考：</strong></p>
<p align="left"><strong>3.</strong><strong>基于域名的虚拟主机的访问，例子如下</strong></p>
<pre>NameVirtualHost 10.29.20.22 

&lt;VirtualHost <a href="http://www.realqi.cn">www.realqi.cn</a>&gt;
    ServerAdmin <a href="mailto:cacti@realqi.cn">cacti@realqi.cn</a>
    DocumentRoot "/usr/local/apache2/htdocs/"
    ServerName  <a href="http://www.realqi.cn">www.realqi.cn</a>
    DirectoryIndex rd.html
&lt;/VirtualHost&gt;
 
&lt;VirtualHost develop.realqi.cn&gt;
    ServerAdmin <a href="mailto:cacti@realqi.cn">cacti@realqi.cn</a>
    DocumentRoot "/usr/local/apache2/htdocs/wordpress/"
    ServerName  develop.realqi.cn
    DirectoryIndex index.php
&lt;/VirtualHost&gt;</pre>
<h3>相关文章</h3>
<ul class="related_post">
<li>2009年10月21日 -- <a href="http://www.realqi.cn/2009/10/apache-dont-log-specific-ip-address-and-user-agents/" title="Apache Don&#8217;t Log Specific IP Address and User-Agents">Apache Don&#8217;t Log Specific IP Address and User-Agents (3)</a></li>
<li>2009年09月21日 -- <a href="http://www.realqi.cn/2009/09/%e5%ae%89%e8%a3%85lamp%e7%8e%af%e5%a2%83%e6%a0%87%e5%87%86%e7%89%88/" title="安装LAMP环境(未完成版)">安装LAMP环境(未完成版) (5)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.realqi.cn/2009/10/apache%e9%85%8d%e7%bd%ae%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%9a%84%e4%b8%89%e7%a7%8d%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安装LAMP环境(未完成版)</title>
		<link>http://www.realqi.cn/2009/09/%e5%ae%89%e8%a3%85lamp%e7%8e%af%e5%a2%83%e6%a0%87%e5%87%86%e7%89%88/</link>
		<comments>http://www.realqi.cn/2009/09/%e5%ae%89%e8%a3%85lamp%e7%8e%af%e5%a2%83%e6%a0%87%e5%87%86%e7%89%88/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 07:56:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[技术实践]]></category>
		<category><![CDATA[系统管理]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[system install]]></category>

		<guid isPermaLink="false">http://realqi.cn/?p=263</guid>
		<description><![CDATA[lamp环境安装.第一部份:系统安装 第二部份:apache,mysql,php安装  第三部份:相关安全优化]]></description>
			<content:encoded><![CDATA[<h2>一、系统安装</h2>
<p>   一、  系统安装</p>
<ol>
<li>准备工作:操作系统版本，规划分区信息，IP地址，掩码，网关，root口令</li>
<li>操作系统版本选择Centos4.7</li>
<li>分区    对于整个硬盘选择自动分区</li>
<li>配置静态IP,Gateway,DNS Server,Hostname（根据情况可不设定dns）</li>
<li>防火墙 选中 Remote Login(SSH)   选中 Web Server(HTTP,HTTPS)</li>
<li>安装方试可以通过光盘,pxe安装等   </li>
<li>语言:选择English(USA)</li>
<li>时区:Aisa/Shangai</li>
<li>软件包:选中</li>
</ol>
<pre>        X Window System
        GNOME Desktop Environmen
        Editors
        Development Tools
        X software Development
        Legacy Software Development</pre>
<p>  二、  安装后的必要配置</p>
<ol>
<li>修改默认运行级别为：3</li>
<pre> sed  -i -e  "s/id:5:initdefault:/id:3:initdefault:/" /etc/inittab</pre>
<li>配置时间同步：</li>
<pre> /usr/sbin/ntpdate 210.72.145.44</pre>
<li>修改启grup.conf的启动timeout=0</li>
<pre>  sed -i -e  "s/timeout=5/timeout=1/" /boot/grub/grub.conf</pre>
<li>关闭IPV6</li>
<pre>echo "alias net-pf-10 off" &gt;&gt; /etc/modprobe.conf
echo "alias ipv6 off" &gt;&gt; /etc/modprobe.conf
/sbin/chkconfig --level 35 ip6tables off</pre>
<li>关闭不必要的服务</li>
<pre>  for ser in `chkconfig --list   |grep 3:on |awk '{print $1}'`
            do
                echo $ser
                case $ser in
                  crond | irqbalance | microcode_ctl | network | random | sendmail \
                        | sshd | syslog | messagebus | haldaemon | readahead_early \
                        | apmd | readahead_later | readahead | iptables | lvm2-monitor | xinetd | auditd | cpuspeed )
                echo "Base services, Skip"
             ;;
             *)
                 echo "change $ser to off"
                 chkconfig --level 3 $ser off
                 service $ser stop

             ;;

                esac
        done
}</pre>
</ol>
<pre><span style="color: #ff0000;">相关资源
         1.适用于centos4 系列一个KS文件</span>
<span style="color: #ff0000;">         2. 系统配置脚本</span>
<span style="color: #ff0000;">         3.防火墙脚本</span></pre>
<h2>二、  编译安装基本环境</h2>
<p><span style="color: #ff0000;"><strong>  1、 编译安装MySQL</strong></span></p>
<pre>              tar zxvf mysql-5.1.30.tar.gz
              cd mysql-5.1.30
              groupadd mysql
              useradd -g mysql mysql -s /sbin/nologin
              ./configure --prefix=/usr/local/mysql \
                          --localstatedir=/usr/local/mysql/var \
                          --with-client-ldflags=-all-static \
                          --with-mysqld-ldflags=-all-static \
                          --enable-assembler  \
                          --without-innodb \
                          --without-isam \
                          --with-pthread \
                          --enable-thread-safe-client \
                          --with-extra-charsets=all
              make&amp;&amp;make install
              \cp –f support-files/my-medium.cnf /etc/my.cnf
              \cp –f support-files/mysql.server /etc/rc.d/init.d/mysqld
              chmod 700 /etc/rc.d/init.d/mysqld
              chkconfig --add mysqld
              cd /usr/local/mysql
              sed -i 's/skip-federated/#skip-federated/' /etc/my.cnf
              bin/mysql_install_db --user=mysql    
              chown -R root  .
              chown -R mysql var
              chgrp -R mysql .
              bin/mysqld_safe --user=mysql &amp;</pre>
<pre> <span style="color: #ff0000;">注意:</span> 1.可通过如下脚本测试mysql是否安装或启动成功
               export PATH=$PATH:/usr/local/mysql/bin/
             mysql -e 'SELECT VERSION();'
        如果返回如下显示,则安装成功否则请查看mysql的日志.
              +-----------+
              | VERSION() |
              +-----------+
              | 5.1.30      |
              +-----------+
           本例中mysql的日志文件为/usr/local/mysql/var/`hostname`.err</pre>
<p><span style="color: #ff0000;"><strong>     2、 编译安装Apache</strong></span></p>
<pre>              tar jxvf httpd-2.2.10.tar.bz2
              cd httpd-2.2.10
             ./configure  --prefix=/usr/local/apache2  \
                          --enable-static-support  \
                          --enable-static-htpasswd  \
                          --enable-static-htdigest  \
                          --enable-static-rotatelogs  \
                          --enable-static-logresolve  \
                          --enable-static-ab  \
                          --enable-static-checkgid  \
                          --enable-so  \
                          --enable-authz-host  \
                          --enable-mime  \
                          --enable-dir  \
                          --enable-log-config  \
                          --enable-auth-basic=shared  \
                          --enable-authn-file=shared  \
                          --disable-authn-default  \
                          --disable-authz-groupfile  \
                          --disable-authz-user  \
                          --disable-authz-default  \
                          --disable-include  \
                          --disable-filter  \
                          --disable-charset-lite  \
                          --disable-env  \
                          --disable-setenvif  \
                          --enable-autoindex  \
                          --disable-asis  \
                          --disable-cgid  \
                          --enable-cgi  \
                          --enable-negotiation=shared  \
                          --enable-actions=shared  \
                          --enable-alias  \
                          --enable-dav=shared \
                          --enable-dav-fs=shared
              make&amp;&amp;make install
 </pre>
<p><span style="color: #ff0000;"><strong>  3、 编译安装PHP</strong></span></p>
<pre>              tar jxvf php-5.2.6.tar.bz2 
              cd php-5.2.6
              ./configure --prefix=/usr/local/php \
                             --with-apxs2=/usr/local/apache2/bin/apxs \
                             --with-pear --with-zlib-dir \
                             --with-libxml-dir --with-gd \
                             --enable-gd-native-ttf \
                             --enable-gd-jis-conv \
                             --with-freetype-dir --with-jpeg-dir \
                             --with-png-dir --with-ttf=shared \
                             --enable-mbstring \
                             --with-mysql=/usr/local/mysql \
                             --with-mysqli=/usr/local/mysql/bin/mysql_config \
                             --with-config-file-path=/etc --with-iconv \
                             --disable-ipv6 --enable-static \
                             --enable-zend-multibyte \
                             --enable-inline-optimization \
                             --enable-zend-multibyte \
                             --enable-sockets \
                             --enable-soap --with-openssl \
                             --with-gettext
              make&amp;&amp;make install</pre>
<p><strong><span style="color: #ff0000;">  4、 编译安装rrdtool(此软件不需要装,我在这里写出是因为我本人需要用这个做一些监控)</span></strong></p>
<pre>               tar zxvf rrdtool-1.2.29.tar.gz
               cd rrdtool-1.2.29
               yum install -y libart_lgpl-devel.i386
               ./configure  --prefix=/usr \
                            --disable-tcl  --disable-ruby
               make&amp;&amp;make install</pre>
<h2>三、  整合Apache与PHP                  </h2>
<pre> vi /usr/local/apache2/config/httpd.conf
        1.添加用于解析以.php结尾的文件的指令   
                AddType application/x-httpd-php .php .phtml
                AddType application/x-httpd-php-source .phps  
        2.修改默认打开的页面为index.php 找到
                &lt;IfModule dir_module&gt;
                      DirectoryIndex index.html
                &lt;/IfModule&gt;
       修改成：
                   &lt;IfModule dir_module&gt;
                     DirectoryIndex  index.php index.html
                &lt;/IfModule&gt;</pre>
<p>可用下面的脚本来进行</p>
<pre>file=/usr/local/apache2/conf/httpd.conf
sed -i '309 a\ AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps' $file
sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/' $file</pre>
<p>  找到：      </p>
<pre>            #Include conf/extra/httpd-mpm.conf
            #Include conf/extra/httpd-info.conf
            #Include conf/extra/httpd-default.conf</pre>
<p>     分别去掉前面的#保存退出</p>
<p>     测试整合        </p>
<pre>            echo   '&lt;?php phpinfo(); ?&gt;' &gt;/usr/local/apache2/htdocs/index.php
            /usr/local/apache2/bin/apachectl restart</pre>
<h2>四、  系统初化配置</h2>
<p>             1、vi conf/extra/httpd-default.conf  修改以下列出的几项为如下                </p>
<pre>            ServerTokens Prod
            ServerSignature Off
            HostnameLookups Off</pre>
<p>           2、vi conf/extra/httpd-info.conf</p>
<pre>            &lt;Location /server-status&gt;
                      SetHandler server-status
                      Order deny,allow
                      Deny from all
                      Allow from 10.11 127.0.0.1
            &lt;/Location&gt;
            ExtendedStatus On</pre>
<h3>相关文章</h3>
<ul class="related_post">
<li>2009年10月15日 -- <a href="http://www.realqi.cn/2009/10/apache%e9%85%8d%e7%bd%ae%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%9a%84%e4%b8%89%e7%a7%8d%e6%96%b9%e6%b3%95/" title="APACHE配置虚拟主机的三种方法">APACHE配置虚拟主机的三种方法 (0)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.realqi.cn/2009/09/%e5%ae%89%e8%a3%85lamp%e7%8e%af%e5%a2%83%e6%a0%87%e5%87%86%e7%89%88/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

