<?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>Apache &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Sun, 04 May 2014 08:20:13 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>
	<item>
		<title>windows下手动搭建Apache+PHP+MySQL</title>
		<link>https://www.mudbest.com/windows%e4%b8%8b%e6%89%8b%e5%8a%a8%e6%90%ad%e5%bb%baapachephpmysql/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Tue, 30 Oct 2012 06:09:37 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[下载]]></category>
		<category><![CDATA[安装]]></category>
		<category><![CDATA[配置]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=1642</guid>

					<description><![CDATA[一、下载 http://pan.baidu.com/share/link?shareid=95859&#038 ... <a title="windows下手动搭建Apache+PHP+MySQL" class="read-more" href="https://www.mudbest.com/windows%e4%b8%8b%e6%89%8b%e5%8a%a8%e6%90%ad%e5%bb%baapachephpmysql/" aria-label="阅读 windows下手动搭建Apache+PHP+MySQL">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p><strong>一、下载</strong><br />
http://pan.baidu.com/share/link?shareid=95859&#038;uk=2349308099</p>
<p><strong>二、安装、解压</strong><br />
 1. Apache</p>
<p>　　主要配置Network Domain、Server Name、Email地址（我依次填的是localhost、localhost、邮箱随意）以及Apache服务的占用端口，默认为80端口，你可以根据需要配置在其他端口，Apache的安装目录你可以使用默认目录或根据需要自行选择安装目录（我安装到 D:\Apache）。<span id="more-1642"></span></p>
<p>　　在完成apache服务的安装后，在游览器中输入http://localhost/，出现It’s work!字样，说明Apache服务安装成功了。</p>
<p>2. PHP</p>
<p>　　只要解压php-5.3.4-Win32-VC6-x86.zip并重名为文件夹为php到某个盘即可完成PHP安装（我是将其解压复制到D盘目录下 D:\web_server\php5.3）</p>
<p> 3. MySQL</p>
<p>　　点击Mysql安装程序自动安装，在此期间你可以根据需要选择Mysql数据库的安装目录（我安装到 D:\web_server\MySQL），MySQL 安装完后会启动向导，你可以先取消，下一部的配置里有说。 </p>
<p><strong>三、配置 </strong><br />
<em><br />
 1. Apache（Apache配置文件httpd.conf在Apache安装目录下的conf文件夹里面）</em></p>
<p>(1)默认Apache服务器执行WEB主程序的目录为Apache2.2/htdocs，所以当你的WEB主程序目录变更时，我们需要修改相应的Apache配置（我改到D:\web_server\apache2.2\htdocs），即用文本编辑软件打开 httpd.conf 将 </p>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
&lt;Directory /&gt;
	Options FollowSymLinks
	AllowOverride None
	Order deny,allow
	Deny from all
&lt;/Directory&gt;
</pre>
<p>将其注释掉</p>
<pre class="brush: plain; title: ; notranslate">
#&lt;Directory /&gt;
#	Options FollowSymLinks
#	AllowOverride None
#	Order deny,allow
#	Deny from all
#&lt;/Directory&gt;
</pre>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
&lt;Directory &quot;D:/web_server/apache2.2/htdocs&quot;&gt;
	#
	# Possible values for the Options directive are &quot;None&quot;, &quot;All&quot;,
	# or any combination of:
	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
	#
	# Note that &quot;MultiViews&quot; must be named *explicitly* --- &quot;Options All&quot;
	# doesn't give it to you.
	#
	# The Options directive is both complicated and important.  Please see
	# http://httpd.apache.org/docs/2.2/mod/core.html#options
	# for more information.
	#
	Options Indexes FollowSymLinks

	#
	# AllowOverride controls what directives may be placed in .htaccess files.
	# It can be &quot;All&quot;, &quot;None&quot;, or any combination of the keywords:
	#   Options FileInfo AuthConfig Limit
	#
	AllowOverride None

	#
	# Controls who can get stuff from this server.
	#
	Order allow,deny
	Allow from all

&lt;/Directory&gt;
</pre>
<p>将其注释</p>
<pre class="brush: plain; title: ; notranslate">
#&lt;Directory &quot;D:/web_server/apache2.2/htdocs&quot;&gt;
	#
	# Possible values for the Options directive are &quot;None&quot;, &quot;All&quot;,
	# or any combination of:
	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
	#
	# Note that &quot;MultiViews&quot; must be named *explicitly* --- &quot;Options All&quot;
	# doesn't give it to you.
	#
	# The Options directive is both complicated and important.  Please see
	# http://httpd.apache.org/docs/2.2/mod/core.html#options
	# for more information.
	#
#	Options Indexes FollowSymLinks

	#
	# AllowOverride controls what directives may be placed in .htaccess files.
	# It can be &quot;All&quot;, &quot;None&quot;, or any combination of the keywords:
	#   Options FileInfo AuthConfig Limit
	#
#	AllowOverride None

	#
	# Controls who can get stuff from this server.
	#
#	Order allow,deny
#	Allow from all

#&lt;/Directory&gt;
</pre>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
#Include conf/extra/httpd-vhosts.conf
</pre>
<p>将注释去掉</p>
<pre class="brush: plain; title: ; notranslate">
Include conf/extra/httpd-vhosts.conf
</pre>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
#LoadModule rewrite_module modules/mod_rewrite.so
</pre>
<p>将注释去掉</p>
<pre class="brush: plain; title: ; notranslate">
#LoadModule rewrite_module modules/mod_rewrite.so
</pre>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
</pre>
<p>回车下一行增加以下内容</p>
<pre class="brush: plain; title: ; notranslate">
LoadModule php5_module &quot;D:/web_server/php5.3/php5apache2_2.dll&quot;
PHPIniDir &quot;D:/web_server/php5.3/&quot;
</pre>
<p>说明：在PHP目录下可以看到多个php5apache的DLL文件，由于我使用的是Apache2.2.17，所以我们当然需要使用php5apache2_2.dll，接着指定PHP的安装目录以及执行的程序扩展名。 </p>
<p><em> 2. PHP（配置文件php.ini在PHP安装目录下）</em></p>
<p>(1)把php.ini-development改名为php.ini，然后用文本编辑器修改php.ini，接下来的步骤都是在php.ini进行的。</p>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
; On windows:

; extension_dir = &quot;ext&quot;
</pre>
<p>修改为</p>
<pre class="brush: plain; title: ; notranslate">
; On windows:

extension_dir = &quot;D:/php/ext&quot;
</pre>
<p>表示指定PHP扩展包的具体目录，以便调用相应的DLL文件，这样就不用讲PHP的一些dll和php.ini复制到windows下了。</p>
<p>由于默认PHP并不支持自动连接Mysql，需开启相应的扩展库功能，比如php_mysql.dll等，即将 </p>
<pre class="brush: plain; title: ; notranslate">
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
;
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_fileinfo.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll 
; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
extension=php_openssl.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll

; The MIBS data available in the PHP distribution must be installed. 
; See http://www.php.net/manual/en/snmp.installation.php 
;extension=php_snmp.dll

;extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite.dll
extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_zip.dll

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
</pre>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
;session.save_path = &quot;/tmp&quot;
</pre>
<p>修改为</p>
<pre class="brush: plain; title: ; notranslate">
session.save_path = &quot;D:/web_server/php5.3/session&quot;
</pre>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
;upload_tmp_dir =
</pre>
<p>修改为</p>
<pre class="brush: plain; title: ; notranslate">
upload_tmp_dir = &quot;D:/web_server/php5.3/temp&quot;
</pre>
<p>找到</p>
<pre class="brush: plain; title: ; notranslate">
;date.timezone =
</pre>
<p>修改为</p>
<pre class="brush: plain; title: ; notranslate">
date.timezone = &quot;Asia/Shanghai&quot;
</pre>
<p><em>3. MySQL</em><br />
点击开始菜单下Mysql Server5.5菜单中的Mysql Server Instance Config Wizard，完成Mysql的配置向导。</p>
<p>点击 Next》 后出现3个选项：选择Mysql服务器的类型</p>
<p>Developer Machine</p>
<p>Server Machine</p>
<p>Dedicated MySQL Machine</p>
<p>我选第2个“Server Machine”</p>
<p>然后又是3个选项：Mysql数据库用途</p>
<p>Multifunctional Database</p>
<p>Transactional Database Only</p>
<p>Non-Transactional Database Only</p>
<p>我选第1个“Multifunctional Database”</p>
<p>选择Mysql数据库的并发连接数</p>
<p>Decision Support （DSS）/OLAP：最大20个连接并发数</p>
<p>Online Transaction Processing（OLTP）：最大500个并发连接数</p>
<p>Manual Setting：自定义</p>
<p>我选自定义，设置为50</p>
<p>选择Mysql服务的端口号，一般默认即可</p>
<p>选择Mysql数据库的字符集（推荐使用UTF8，比较通用，否则容易造成乱码。）</p>
<p>Standard Character Set</p>
<p>Best Support For Multilingualism</p>
<p>Manual Selected Default Character Set / Collation</p>
<p>我选“Manual Selected Default Character Set / Collation”，然后在 Character Set 选择 utf8</p>
<p>设置Mysql为Windows服务</p>
<p>在这里考虑开机速度的问题，我将自动登录Mysql服务取消了，一般你可以选择此选项，如果没有选，你可以使用net start mysql启动Mysql服务（停止就是net stop mysql）。</p>
<p>我的选择是“Install AS Windows Service”和“Include Bin Directory in Windows PATH”勾选，“Launch the MySQL Server automatically”去掉勾选</p>
<p>设置Mysql数据库root用户的密码</p>
<p>执行Mysql服务配置选项</p>
<p>Mysql数据库的配置文件保存在D:\MySQL\my.ini，如果今后有什么变动，你可以修改此文件。 </p>
<p>到此，所有配置完成。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>ubuntu12.04下memcached安装与配置</title>
		<link>https://www.mudbest.com/ubuntu12-04%e4%b8%8bmemcached%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Mon, 29 Oct 2012 05:11:37 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[安装]]></category>
		<category><![CDATA[服务]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=1625</guid>

					<description><![CDATA[其中包括memcache服务器端的安装和memcached客户端的安装。 所谓服务器端的安装就是在服务器（一般 ... <a title="ubuntu12.04下memcached安装与配置" class="read-more" href="https://www.mudbest.com/ubuntu12-04%e4%b8%8bmemcached%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae/" aria-label="阅读 ubuntu12.04下memcached安装与配置">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>其中包括memcache服务器端的安装和memcached客户端的安装。<br />
所谓服务器端的安装就是在服务器（一般都是linux系统）上安装Memcache实现数据的存储</p>
<p>所谓客户端的安装就是指php（或者其他程序，memcache还有其他不错的api接口提供）去使用服务器端的memcache提供的函数，客户端需要php添加扩展。</p>
<p><strong>安装Memcache服务端</strong></p>
<pre class="brush: plain; title: ; notranslate">
sudo apt-get install memcached
</pre>
<p><span id="more-1625"></span><br />
安装完Memcache服务端以后，我们需要启动该服务：</p>
<pre class="brush: plain; title: ; notranslate">
memcached -d -m 128 -p 11111 -u root
</pre>
<p>这里需要说明一下memcached服务的启动参数：</p>
<pre class="brush: plain; title: ; notranslate">
-p 监听的端口
-l 连接的IP地址, 默认是本机
-d start 启动memcached服务
-d restart 重起memcached服务
-d stop|shutdown 关闭正在运行的memcached服务
-d install 安装memcached服务
-d uninstall 卸载memcached服务
-u 以的身份运行 (仅在以root运行的时候有效)
-m 最大内存使用，单位MB。默认64MB
-M 内存耗尽时返回错误，而不是删除项
-c 最大同时连接数，默认是1024
-f 块大小增长因子，默认是1.25-n 最小分配空间，key+value+flags默认是48
-h 显示帮助
-P 是设置保存Memcache的pid文件
</pre>
<p>如果要杀掉memcached进程</p>
<pre class="brush: plain; title: ; notranslate">
kill 'cat /tmp/memcached.pid'
</pre>
<p>也可以启动多个守护进程，不过端口不能重复。<br />
重启web服务<br />
[/code lang=&#8221;text&#8221;]<br />
/etc/init.d/lighttpd -flighttpd.conf restart<br />
[/code]</p>
<p>Memcache环境测试：</p>
<pre class="brush: plain; title: ; notranslate">
telnet localhost 11211
//保存
set
good 32 0 10
helloworld
STORED
//取回
gets good
VALUE good 32 10 10
helloworld
END
//替换
replace good 32 0 10
worldhello
STORED
get good
VALUE good 32 10
worldhello
END
//尾部添加
append good 32 0 5
after
STORED
get good
VALUE good 32 15
worldhelloafter
END
//头部添加
prepend good 32 0 6
before
STORED
get good
VALUE good 32 21
beforeworldhelloafter
END
//删除
delete good
DELETED
get good
END
</pre>
<p><strong>安装memcache客户端（php5.3为示例）</strong></p>
<pre class="brush: plain; title: ; notranslate">
sudo apt-get install php5-memcache
</pre>
<p>安装完以后我们需要在php.ini里进行简单的配置,打开/etc/php5/apache2/php.ini文件在末尾添加如下内容：</p>
<pre class="brush: plain; title: ; notranslate">
cp /etc/php5/apache2/php.ini /etc/php5/apache2.php.ini.bak
vi /etc/php5/apache2/php.ini
</pre>
<p>在文件内容最下面增加以下配置信息</p>
<pre class="brush: plain; title: ; notranslate">
&#x5B;Memcache]
;是否在遇到错误时透明的向其他服务器进行故障转移
memcache.allow_failover = On
;接受和发送数据时最多尝试多少个服务器，只在打开memcache.allow_failover时生效。
memcache.max_failover_attempts = 20
;数据将俺按照此值设定的块大小进行转移。此值越小所需的额外网络传输越多。
;如果发现无法解释的速度降低，可以尝试将此值增加到32768。
memcache.chunk_size = 8192
;链接到memcached服务器时使用的默认TCP端口。
memcache.default.port = 11111
;控制将key映射到server的策略。默认值“standard”表示使用先前版本的老hash策略
;设为“consistent”可以允许在链接池中添加/删除服务器时不必重新计算key与server之间&gt;的映射关系。
;memcache.hash_strategy = &quot;standard&quot;
;控制将key映射到server的散列函数。默认值“crc32”使用CRC32算法，而“fnv”则表示使用FNV-1a算法。
;FNV-1a比CRC32速度稍低，但是散列效果更好。
;memcache.hash_function = &quot;crc32&quot;
</pre>
<p><a href="http://www.mudbest.com/ubuntu12-04%e4%b8%8bmemcached%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae/2012-10-26memcached/" rel="attachment wp-att-1627" target="_blank"><img fetchpriority="high" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/10/2012-10-26memcached.png" alt="" title="2012-10-26memcached" width="1280" height="1024" class="alignnone size-full wp-image-1627" srcset="https://www.mudbest.com/wp-content/uploads/2012/10/2012-10-26memcached.png 1280w, https://www.mudbest.com/wp-content/uploads/2012/10/2012-10-26memcached-537x430.png 537w, https://www.mudbest.com/wp-content/uploads/2012/10/2012-10-26memcached-1024x819.png 1024w" sizes="(max-width: 1280px) 100vw, 1280px" /></a></p>
<p>最后，保存php.ini,执行sudo /etc/init.d/apache2 restart重启Apache。</p>
<p><strong>在PHP中使用memcache</strong></p>
<pre class="brush: sql; title: ; notranslate">
#mysql数据库部分：
CREATE TABLE `conn` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gb2312 AUTO_INCREMENT=7 ;
</pre>
<pre class="brush: php; title: ; notranslate">
//PHP代码部分
&lt;form action=&quot;&quot; method=&quot;get&quot;&gt;
	&lt;input type=&quot;text&quot; name=&quot;keys&quot;&gt; 
	&lt;input type=&quot;submit&quot; value=&quot;提交&quot;&gt;
&lt;/form&gt;
&lt;?php
if (! empty ( $_GET &#x5B;'keys'] )) {
	$arr = mem_db ( $_GET &#x5B;'keys'] );
	print_r ( $arr );
}
function mem_db($str) {
	$m = new memcache ();
	$m-&gt;connect ( &quot;127.0.0.1&quot;, 11211 ) or die ( &quot;连接错误&quot; );
	$mi = base64_encode ( $str ); // 加密进来的数据
	$exp = $m-&gt;get ( $mi );
	if (empty ( $exp )) {
		$row = sql_db ( $str ); // 数据库php100
		$m-&gt;set ( $mi, $row, 0, 3600 );
	}
	
	return $m-&gt;get ( $mi );
}
function sql_db($str) {
	mysql_connect ( &quot;localhost&quot;, &quot;root&quot;, &quot;2222&quot; );
	mysql_select_db ( &quot;news&quot; );
	mysql_query ( &quot;set names 'GBK'&quot; );
	$sql = &quot;select * from conn where title like '%&quot; . $str . &quot;%'&quot;;
	$query = mysql_query ( $sql );
	while ( $rs = mysql_fetch_array ( $query ) ) {
		$ru &#x5B;] = $rs;
	}
	return $ru;
}
?&gt;
</pre>
<p>到此为止，通过上面的步骤，我们就完成了memcache的配置和基本使用…</p>
<p><strong>php5-memcache扩展提供的方法</strong></p>
<pre class="brush: plain; title: ; notranslate">
Memcache::add — 添加一个值，如果已经存在，则返回false
Memcache::addServer — 添加一个可供使用的服务器地址
Memcache::close — 关闭一个Memcache对象
Memcache::connect — 创建一个Memcache对象
memcache_debug — 控制调试功能
Memcache::decrement — 对保存的某个key中的值进行减法操作
Memcache::delete — 删除一个key值
Memcache::flush — 清除所有缓存的数据
Memcache::get — 获取一个key值
Memcache::getExtendedStats — 获取进程池中所有进程的运行系统统计
Memcache::getServerStatus — 获取运行服务器的参数
Memcache::getStats — 返回服务器的一些运行统计信息
Memcache::getVersion — 返回运行的Memcache的版本信息
Memcache::increment — 对保存的某个key中的值进行加法操作
Memcache::pconnect — 创建一个Memcache的持久连接对象
Memcache::replace — R对一个已有的key进行覆写操作
Memcache::set — 添加一个值，如果已经存在，则覆写
Memcache::setCompressThreshold — 对大于某一大小的数据进行压缩
Memcache::setServerParams — 在运行时修改服务器的参数
</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Apache开启Gzip页面压缩功能(可大幅度提高网页浏览速度)</title>
		<link>https://www.mudbest.com/apache%e5%bc%80%e5%90%afgzip%e9%a1%b5%e9%9d%a2%e5%8e%8b%e7%bc%a9%e5%8a%9f%e8%83%bd%e5%8f%af%e5%a4%a7%e5%b9%85%e5%ba%a6%e6%8f%90%e9%ab%98%e7%bd%91%e9%a1%b5%e6%b5%8f%e8%a7%88%e9%80%9f%e5%ba%a6/</link>
					<comments>https://www.mudbest.com/apache%e5%bc%80%e5%90%afgzip%e9%a1%b5%e9%9d%a2%e5%8e%8b%e7%bc%a9%e5%8a%9f%e8%83%bd%e5%8f%af%e5%a4%a7%e5%b9%85%e5%ba%a6%e6%8f%90%e9%ab%98%e7%bd%91%e9%a1%b5%e6%b5%8f%e8%a7%88%e9%80%9f%e5%ba%a6/#comments</comments>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Mon, 04 Jun 2012 07:13:15 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Gzip]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=1085</guid>

					<description><![CDATA[Apache默认是没有开启Gzip模块的，需要手动将其打开。 关于IIS6.0的GZIP开启方法与Apache ... <a title="Apache开启Gzip页面压缩功能(可大幅度提高网页浏览速度)" class="read-more" href="https://www.mudbest.com/apache%e5%bc%80%e5%90%afgzip%e9%a1%b5%e9%9d%a2%e5%8e%8b%e7%bc%a9%e5%8a%9f%e8%83%bd%e5%8f%af%e5%a4%a7%e5%b9%85%e5%ba%a6%e6%8f%90%e9%ab%98%e7%bd%91%e9%a1%b5%e6%b5%8f%e8%a7%88%e9%80%9f%e5%ba%a6/" aria-label="阅读 Apache开启Gzip页面压缩功能(可大幅度提高网页浏览速度)">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>Apache默认是没有开启Gzip模块的，需要手动将其打开。</p>
<p>关于IIS6.0的GZIP开启方法与Apache截然不同，虽然也是修改文件，但却有着实质性的差异。</p>
<p>首先需要打开与Gzip相关的模块。</p>
<p>1. httpd.conf中打开deflate_Module和headers_Module模块 <span id="more-1085"></span><br />
<a href="http://www.mudbest.com/1085.action/attachment/3333" rel="attachment wp-att-1099"><img decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/06/3333-505x430.jpg" alt="" title="3333" width="505" height="430" class="alignnone size-medium wp-image-1099" srcset="https://www.mudbest.com/wp-content/uploads/2012/06/3333-505x430.jpg 505w, https://www.mudbest.com/wp-content/uploads/2012/06/3333.jpg 612w" sizes="(max-width: 505px) 100vw, 505px" /></a><br />
2.在httpd.conf最下方增加以下代码(如图)：</p>
<p><a href="http://www.mudbest.com/1085.action/2-11" rel="attachment wp-att-1087"><img decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/06/2-610x407.jpg" alt="" title="2" width="610" height="407" class="alignnone size-medium wp-image-1087" srcset="https://www.mudbest.com/wp-content/uploads/2012/06/2-610x407.jpg 610w, https://www.mudbest.com/wp-content/uploads/2012/06/2.jpg 838w" sizes="(max-width: 610px) 100vw, 610px" /></a></p>
<pre class="brush: plain; title: ; notranslate">
&lt;IfModule deflate_module&gt;
	SetOutputFilter DEFLATE
	#这里开始声明哪些不进行压缩
	SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
	SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
	SetEnvIfNoCase Request_URI .(?:pdf|doc|ppt)$ no-gzip dont-vary
	#声明结束
	AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
	AddOutputFilterByType DEFLATE application/x-javascript
	#针对代理服务器设置
	&lt;IFModule headers_module&gt;
		Header append vary User-Agent
	&lt;/IFModule&gt;
&lt;/IfModule&gt;
</pre>
<p>当启用之后测试一下效果。</p>
<p>未Gzi启用前<br />
<a href="http://www.mudbest.com/1085.action/nogzip" rel="attachment wp-att-1089"><img loading="lazy" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/06/nogzip.jpg" alt="" title="nogzip" width="392" height="214" class="alignnone size-full wp-image-1089" /></a></p>
<p>启用Gzip之后<br />
<a href="http://www.mudbest.com/1085.action/yesgzip-2" rel="attachment wp-att-1091"><img loading="lazy" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/06/yesgzip1.jpg" alt="" title="yesgzip" width="400" height="243" class="alignnone size-full wp-image-1091" /></a></p>
<p>可以明显看得出在启用前与启用后的差异，这也是优化了网络浏览速度的一种方法。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mudbest.com/apache%e5%bc%80%e5%90%afgzip%e9%a1%b5%e9%9d%a2%e5%8e%8b%e7%bc%a9%e5%8a%9f%e8%83%bd%e5%8f%af%e5%a4%a7%e5%b9%85%e5%ba%a6%e6%8f%90%e9%ab%98%e7%bd%91%e9%a1%b5%e6%b5%8f%e8%a7%88%e9%80%9f%e5%ba%a6/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>windwos下Apache mod_rewrite</title>
		<link>https://www.mudbest.com/windwos%e4%b8%8bapache-mod_rewrite/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Fri, 09 Mar 2012 08:08:05 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[rewrite]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=903</guid>

					<description><![CDATA[windows环境下使用Apache .htaccess 文件 1.修改httpd.conf配置文件 设定目录 ... <a title="windwos下Apache mod_rewrite" class="read-more" href="https://www.mudbest.com/windwos%e4%b8%8bapache-mod_rewrite/" aria-label="阅读 windwos下Apache mod_rewrite">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>windows环境下使用Apache .htaccess 文件</p>
<p><strong>1.修改httpd.conf配置文件</strong></p>
<p>设定目录权限<span id="more-903"></span></p>
<p>Options FollowSymLinks<br />
<span style="color: #ff0000;">AllowOverride None // 将None 改为 all</span><br />
Order deny,allow<br />
Deny from all</p>
<p>设定虚拟目录<br />
// localhost 可改为域名<br />
ServerAdmin webmaster@localhost<br />
DocumentRoot &#8220;D:/website/mudbest/&#8221;<br />
ServerName localhost<br />
ErrorLog logs/localhost-error_log<br />
CustomLog logs/localhost-access_log common</p>
<p>Options Indexes FollowSymLinks<br />
<span style="color: #ff0000;">AllowOverride None // 将None 改为 all</span><br />
Order allow,deny<br />
Allow from all</p>
<p>去掉<br />
<span style="color: #ff0000;">#LoadModule rewrite_module modules/mod_rewrite.so</span><br />
注释</p>
<p><strong>2.在需要需要控制的目录下新建.htaccess文件</strong></p>
<p>ErrorDocument 401 /PHPMYSQLWD4E/Chapter17/rejection.html<br />
AuthUserFile D:/website/mudbest/LearnCode/PHPMYSQLWD4E/Chapter17/.htpass<br />
AuthGroupFile C:/php<br />
AuthName &#8220;Realm-Name&#8221;<br />
AuthType Basic<br />
require valid-user</p>
<p><strong>3.在需要控制的目录下或WEB目录外建立.htpass密码文件</strong></p>
<p>user1:pass1</p>
<p>可以使用Apache/bin 目录下的 htpasswd 工具生成。</p>
<p>&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;`<br />
CentOS开启Apache mod_rewrite</p>
<p>mod_rewrite能使网页伪静态,对于搜索引擎友好,下面就是开启这个功能的说明！<br />
启用mod_rewrite模块<br />
在conf目录的httpd.conf文件中找到<br />
<span style="color: #ff0000;">LoadModule rewrite_module modules/mod_rewrite.so</span><br />
将这一行前面的#去掉。<br />
2.在要支持url rewirte的目录启用 Options FollowSymLinks和AllowOverride All</p>
<p>Options Indexes FollowSymLinks<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>apache 防盗链的相关应用</title>
		<link>https://www.mudbest.com/apache-%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e7%9b%b8%e5%85%b3%e5%ba%94%e7%94%a8/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Thu, 08 Mar 2012 06:15:39 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[apache防盗链]]></category>
		<category><![CDATA[防盗链]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=896</guid>

					<description><![CDATA[防盗链原理： http标准协议中有专门的字段记录referer 一来可以追溯上一个入站地址是什么 二来对于资源 ... <a title="apache 防盗链的相关应用" class="read-more" href="https://www.mudbest.com/apache-%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e7%9b%b8%e5%85%b3%e5%ba%94%e7%94%a8/" aria-label="阅读 apache 防盗链的相关应用">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>防盗链原理：<br />
http标准协议中有专门的字段记录referer<br />
一来可以追溯上一个入站地址是什么<br />
二来对于资源文件，可以跟踪到包含显示他的网页地址是什么。<br />
<span id="more-896"></span><br />
因此所有防盗链方法都是基于这个Referer字段<br />
众所周知，目前Apache的防盗链莫非就那2种，一是FilesMatch ，二是rewirte。</p>
<p>&lt;strong&gt;第一种：使用FilesMatch&lt;/strong&gt;<br />
&lt;VirtualHost *:80&gt;<br />
ServerAdmin webmaster@localhost<br />
DocumentRoot D:/www/mudbest.com<br />
ServerName www.mudbest.com<br />
ServerName mudbest.com<br />
盗用连接指定显示的页面。也可以不用此项，这样盗用连接也可无法使用。注：用其他地址，比如http://bbb.com/error.html<br />
ErrorDocument 404 http://bbb.com/error.html<br />
允许www.aaa.com的网站使用<br />
SetEnvIfNoCase Referer &#8220;^http://www.mudbest.com&#8221; local_ref=1<br />
允许 aaa.com   的网站使用<br />
SetEnvIfNoCase Referer &#8220;^http://mudbest.com&#8221; local_ref=1<br />
定义防盗文件的扩展名<br />
&lt;FilesMatch &#8220;\.(gif|jpg|png|css|js|swf)&#8221;&gt;<br />
Order Allow,Deny<br />
Allow from env=local_ref   允许上面指定域名<br />
&lt;/FilesMatch&gt;<br />
&lt;/VirtualHost&gt;</p>
<p>&nbsp;</p>
<p>防盗链设置样本（使用正则表达式）：</p>
<p><span style="color: #000080;">SetEnvIf Referer &#8220;^http://(.)+\.ilinux\.cn/&#8221; local_ref=1</span><br />
<span style="color: #000080;">SetEnvIf Referer &#8220;^http://(.)+\.isql\.cn/&#8221; local_ref=1</span><br />
<span style="color: #000080;">#SetEnvIf Referer &#8220;^http://(.)+\.other\.org\.cn/&#8221; local_ref=1</span><br />
<span style="color: #008000;">SetEnvIf Request_URI &#8220;/logo(.)+&#8221; local_ref=0</span><br />
<span style="color: #ff9900;">&lt;FilesMatch &#8220;\.(</span><span style="color: #800080;">mp3|wmv|png|gif|jpg|jpeg|avi|bmp|ram|rmvb|rm|rar|zip|mp3</span><span style="color: #ff9900;">)&#8221;&gt;</span><br />
<span style="color: #ff9900;">Order Allow,Deny</span><br />
<span style="color: #ff9900;">Allow from env=local_ref</span><br />
<span style="color: #ff9900;">&lt;/FilesMatch&gt;</span></p>
<p>解释：<br />
1. <span style="color: #0000ff;">蓝色部分</span>，表示设置允许访问的referer地址，第一行的意思为所有http协议访问，以.ilinux.cn结尾的域名地址，第二行类似，只是换成 了.isql.cn，表问我前面的鬼符是什么，不懂得可以去翻正则表达式的研究文献，不想深究的可以照猫画虎设置自己的网站。<br />
2. <span style="color: #00ff00;">绿色部分</span>，表示不在上述引用域名范围内，但可以被放行的特例，本例中表示网站/目录，所有以logo开头的文件(用作允许其它网站的友情连接引用本站logo)。<br />
3. <span style="color: #ff9900;">橙色部分</span>是设置反盗链的关键部分，上面每一个设置都联系到了local_ref这个环境变量，只有这个变量为1，则允许被引用，否则显示一个X。<br />
4. <span style="color: #800080;">紫色部分</span>设置了哪些扩展名的文件加入反盗链的规则。</p>
<p><strong>第二种方法： rewirte</strong></p>
<p>&lt;VirtualHost *:80&gt;<br />
ServerAdmin webmaster@localhost<br />
DocumentRoot &#8220;F:/websites/mudbest/&#8221;<br />
ServerName www.mudbest.com<br />
RewriteEngine on<br />
<span style="color: #0000ff;">    RewriteCond %{HTTP_REFERER} !^http://www.mudbest.com/.*$ [NC]</span><br />
<span style="color: #0000ff;">    RewriteCond %{HTTP_REFERER} !^http://www.mudbest.com$ [NC]</span><br />
RewriteRule .*.(<span style="color: #00ff00;">jpg|jpeg|gif|png|bmp|rar|zip|pdf|doc|docx|ppt|pptx</span>)$ <span style="color: #ffcc00;">http://cc.test.com/Public/image/logo1.jpg</span> [R,NC]<br />
ErrorLog &#8220;logs/s1.test.com-error.log&#8221;<br />
CustomLog &#8220;logs/s1.test.com-access.log&#8221; common<br />
&lt;/VirtualHost&gt;</p>
<p>&nbsp;</p>
<p>解释：</p>
<p><span style="color: #0000ff;">蓝色部分</span> 白名单，也就是被允许的域名<br />
<span style="color: #00ff00;">绿色部分</span> 防盗链的规则<br />
<span style="color: #ffcc00;">橙色部分</span> 跳转页面</p>
<p>&nbsp;</p>
<p>传统的防盗链都是通过Referer来判断用户来路的，不过这样的方法对于下载工具来说形同虚设，因为现在的下载工具早就能伪造Referer了。<br />
现在一些流行的防盗链的方式都是用在浏览页面的时候产生一个随机验证码，在用户点击连接的时候服务器会验证这个验证码是否有效从而决定是否允许下载。或者就是用某些方法把文件实际地址进行伪装。不过我觉得这些都不怎么好用，我用了一个简单有效的方式来实现防盗链。<br />
其实就是用Cookie，配合Apache的URL Rewrite模块很简单的就能实现防盗链下载。<br />
首先在浏览页面的时候，会向客户端发送一个特别的Cookie，例如“Site=mudbest.Com“，盗链而来的将没有这个Cookie。</p>
<p>在Apache的httpd.conf文件里面搜索：<br />
<span style="color: #ff0000;">#LoadModule rewrite_module modules/mod_rewrite.so</span><br />
把它前面的#去掉，再找到&lt;Directory /&gt;块，在里面加入类似如下代码：</p>
<p>&lt;Directory /&gt;<br />
# Other configurations …<br />
RewriteEngine On # 启动URL Rewrite引擎<br />
RewriteCond %{HTTP_COOKIE} !^.*(?:Site=mudbest.Com).*$ # 对于Cookie里面没有特殊记录的请求进行重定向<br />
RewriteRule ^.*$ error.html # 将非法访问重定向到错误页面<br />
&lt;/Directory&gt;</p>
<p>这样如果一个盗链而来的请求将会因为没有特殊Cookie而被重定向到错误页面，就算实际地址暴露也不怕。至于这个Cookie的内容是什么以及有效时间完全可以由管理员自己来设定，也就是说下载工具也没法伪造，从而防止了服务器资源被盗链的危险。</p>
<p>&nbsp;</p>
<p><strong>线程控制</strong></p>
<p>另外附属下线程限制方法，如果想防止暴力可尝试应用。</p>
<p>限制多线程现在需要用到一个Apache的扩展模块mod_limitipconn。<br />
这里是作者的官方网站。  http://dominia.org/djao/limitipconn2.html<br />
先下载适合自己版本的模块文件到Apache安装目录下的modules目录下面，然后在httpd.conf文件中搜索：</p>
<p><span style="color: #ff0000;">#LoadModule status_module modules/mod_status.so</span></p>
<p>把它前面的#去掉，再加入：</p>
<p>ExtendedStatus On<br />
LoadModule limitipconn_module modules/mod_limitipconn.dll # 如果你下载的不是Win版，请把后面的文件名改为你所下载的文件名<br />
&lt;IfModule mod_limitipconn.c&gt;<br />
&lt;Location /&gt; # 这里表示限制根目录，即全部限制，可以根据需要修改<br />
MaxConnPerIP 2 # 这里表示最多同时两个线程<br />
NoLimit html/* # 这里表示html目录下不受限制<br />
&lt;/Location&gt;<br />
&lt;/IfModule&gt;<br />
这样来自同一客户端的超过2个的线程请求将被拒绝，从而限制了客户端的多线程下载。</p>
<p>&nbsp;</p>
<p><strong>带宽控制</strong><br />
限制下载带宽<br />
这个同样需要扩展模块支持，模块是mod_bw，在作者的官方网站<br />
http://ivn.cl/apache/<br />
可以下载到。同样也是放入modules目录下面，然后在httpd.conf文件中加入：</p>
<p><span style="color: #ff0000;">LoadModule bw_module modules/mod_bw.dll</span><br />
再找到&lt;Directory /&gt;块，加入：</p>
<p>&lt;Directory /&gt;<br />
# Other configurations …<br />
BandwidthModule On # 启动带宽限制<br />
ForceBandwidthModule On # 启动带宽限制<br />
MaxConnection all 2000 # 最大连接数2000<br />
Bandwidth all 200000 # 单个客户端最大带宽200KB<br />
&lt;/Directory&gt;</p>
<p>这样限制了同时最多2000个连接数，每个客户端最大200KB的下载带宽。</p>
<p>到这里就差不多介绍完了关于Apache下面的多种控制的一些应用方法，根据自己的需求方便的控制，方便的应用。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Windows 2008 64位Apache+PHP+MySQL配置</title>
		<link>https://www.mudbest.com/windows-2008-64%e4%bd%8dapachephpmysql%e9%85%8d%e7%bd%ae/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Wed, 07 Mar 2012 01:49:58 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[64位]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows2008]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=886</guid>

					<description><![CDATA[附件安装包默认是d:/case/，目录下，如果放在这个目录可不进行任何设置，可跳到apache安装步骤3，进行 ... <a title="Windows 2008 64位Apache+PHP+MySQL配置" class="read-more" href="https://www.mudbest.com/windows-2008-64%e4%bd%8dapachephpmysql%e9%85%8d%e7%bd%ae/" aria-label="阅读 Windows 2008 64位Apache+PHP+MySQL配置">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>附件安装包默认是d:/case/，目录下，如果放在这个目录可不进行任何设置，可跳到apache安装步骤3，进行开启服务即可。</p>
<p><strong>安装Apache 64位</strong></p>
<p>1.解压</p>
<p>将下载的httpd-2.2.17-win64.rar压缩包解压到某一目录下，如D:\case\Apache2.2</p>
<p>2.编辑配置文件D:\case\Apache2.2\conf\httpd.conf作如下修改【注意路径中必须使用左斜杠】：<span id="more-886"></span></p>
<p>ServerRoot &#8220;/httpd-2.2-x64&#8243;改为</p>
<p>ServerRoot &#8220;D:/case/Apache2.2&#8221;</p>
<p>Listen 80改为</p>
<p>Listen 8080 #端口，若已开启IIS，则80端口就不能使用了</p>
<p>DocumentRoot &#8220;/httpd-2.2-x64/htdocs&#8221;改为</p>
<p>DocumentRoot &#8220;D:/case/Apache2.2/htdocs&#8221; #放置网站文件的路径</p>
<p>DirectoryIndex index.html改为</p>
<p>DirectoryIndex index.html index.htm index.php  #加入index.php，PHP的默认页</p>
<p>ScriptAlias /cgi-bin/ &#8220;/httpd-2.2-x64/cgi-bin/&#8221;改为</p>
<p>ScriptAlias /cgi-bin/ &#8220;D:/case/Apache2.2/cgi-bin/&#8221;</p>
<p><Directory "/httpd-2.2-x64/htdocs">改为</p>
<p><Directory "D:/case/Apache2.2/htdocs"></p>
<p><Directory "/httpd-2.2-x64/cgi-bin">改为</p>
<p><Directory "D:/case/Apache2.2/cgi-bin"></p>
<p>将LoadModule rewrite_module modules/mod_rewrite.so前的#去掉</p>
<p>3.执行安装命令：</p>
<p>进入D:\case\Apache2.2\bin</p>
<p>执行命令：httpd.exe -k install(将apache加入系统服务，默认服务名是Apache2.2)</p>
<p>执行命令：httpd.exe -k start(运行服务)</p>
<p>注：启动多个apache方法<br />
/usr/local/apache2/bin/httpd  -f /路径2/httpd.conf -k start</p>
<p>以后可以使用D:\case\Apache2.2\bin\ApacheMonitor.exe进行服务的开启、关闭、重启与监控等操作</p>
<p>4.测试安装是否成功</p>
<p>打开浏览器，输入：http://localhost:8080，显示It Works！ 说明成功！</p>
<p><strong>安装PHP 64位</strong></p>
<p>1.将下载的php安装包php-5.2.5-x64-2007-11-12.zip中的php-5.2.5 (x64)文件夹复制到某一路径下，如D:\case\PHP</p>
<p>2.修改配置文件D:\case\Apache2.2\conf\httpd.conf</p>
<p>在#LoadModule vhost_alias_module modules/mod_vhost_alias.so一行下加上：</p>
<p>LoadModule php5_module &#8220;D:/case/PHP/php5apache2_2.dll&#8221;</p>
<p>PHPIniDir &#8220;D:/PHP&#8221;</p>
<p>在AddType application/x-gzip .gz .tgz下加上：</p>
<p>AddType application/x-httpd-php .php</p>
<p>AddType application/x-httpd-php .html  #.html, .php为可执行php语言的扩展名</p>
<p>3.将D:\PHP\php.ini-recommended复制为D:\PHP\php.ini，并作如下修改</p>
<p>修改extension_dir = &#8220;./&#8221;为</p>
<p>extension_dir = &#8220;d:/case/php&#8221; #指定动态连接库的目录  php的安装目录</p>
<p><strong>注：dll组件部分根据自己的需求开启，去掉前面的注释“;”即可。</strong><br />
将extension=php_mysql.dll前的分号（注释）去掉</p>
<p>4.测试是否安装成功</p>
<p>修改D:\case\Apache2.2\htdocs\index.html文件，加入：<?php echo phpinfo(); ?></p>
<p>重启httpd服务输入网址：http://loalhost:8080 ，看到php信息，说明成功！</p>
<p>附件包：<br />
<a href='http://www.mudbest.com/886.action/x64-apache2-2-php5-25' rel='attachment wp-att-887'>x64.apache2.2-php5.25</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Apache配置独立域名的方法</title>
		<link>https://www.mudbest.com/apache%e9%85%8d%e7%bd%ae%e7%8b%ac%e7%ab%8b%e5%9f%9f%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95/</link>
					<comments>https://www.mudbest.com/apache%e9%85%8d%e7%bd%ae%e7%8b%ac%e7%ab%8b%e5%9f%9f%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95/#comments</comments>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Mon, 27 Feb 2012 05:55:23 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=874</guid>

					<description><![CDATA[第一步，你要安装Apache软件，就老老实实的一步一步装下去，其中让你填一个东西，我们可以这样写： NETWO ... <a title="Apache配置独立域名的方法" class="read-more" href="https://www.mudbest.com/apache%e9%85%8d%e7%bd%ae%e7%8b%ac%e7%ab%8b%e5%9f%9f%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95/" aria-label="阅读 Apache配置独立域名的方法">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>第一步，你要安装Apache软件，就老老实实的一步一步装下去，其中让你填一个东西，我们可以这样写：</p>
<p>NETWORK DOMAIN ： 127.0.0.1</p>
<p>SERVER NAME ：127.0.0.1<span id="more-874"></span></p>
<p>Administrator&#8217;s Email Address : 写上一个邮箱（随意写）</p>
<p>安装完成后，在本地浏览器输入localhost或者127.0.0.1可以看到网页显示It Works!说明安装Apache成功。</p>
<p>第二部，配置一下Apache</p>
<p>首先，找到Apache的配置文件httpd.conf，在apache\conf\文件夹下面。修改这个文件，按照以下操作，不要问为什么：</p>
<p>①、找到这一行：DocumentRoot &#8220;D:/server/apache/htdocs&#8221;，把以下这几行用#注释掉，如图：</p>
<p><a href="http://www.mudbest.com/874.action/1-10" rel="attachment wp-att-876"><img loading="lazy" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/02/1.jpg" alt="" title="1" width="600" height="265" class="alignnone size-full wp-image-876" /></a></p>
<p>②、找到这一行：<Directory "D:/server/apache/htdocs">，把以下这些行注释掉，如图：</p>
<p><a href="http://www.mudbest.com/874.action/2-8" rel="attachment wp-att-875"><img loading="lazy" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/02/2-585x430.jpg" alt="" title="2" width="585" height="430" class="alignnone size-medium wp-image-875" srcset="https://www.mudbest.com/wp-content/uploads/2012/02/2-585x430.jpg 585w, https://www.mudbest.com/wp-content/uploads/2012/02/2.jpg 639w" sizes="auto, (max-width: 585px) 100vw, 585px" /></a></p>
<p>③、找到这一行：DirectoryIndex index.html，在下面接着写上DirectoryIndex index.php index.html index.htm index.wml，如图：</p>
<p><a href="http://www.mudbest.com/874.action/3-7" rel="attachment wp-att-877"><img loading="lazy" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/02/3.jpg" alt="" title="3" width="488" height="70" class="alignnone size-full wp-image-877" /></a></p>
<p>④、找到这一行：#Include conf/extra/httpd-vhosts.conf，把前面的#去掉</p>
<p>⑤、在这个文件的末尾加上一下三行：</p>
<pre class="brush: plain; title: ; notranslate">
LoadModule php5_module &quot;d:/server/php/php5apache2_2.dll&quot;
AddType application/x-httpd-php .php
PHPIniDir &quot;d:/server/php&quot;
</pre>
<p>注意格式：每一行的后面没有分号，标点符号都是英文</p>
<p>然后，httpd.conf的配置就算完成了，接着配置httpd-vhosts.conf这文件，在apache\conf\extra\文件夹下</p>
<p>把下面的删除：</p>
<p><a href="http://www.mudbest.com/874.action/4-5" rel="attachment wp-att-879"><img loading="lazy" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/02/4.jpg" alt="" title="4" width="520" height="275" class="alignnone size-full wp-image-879" /></a></p>
<p>然后加上自己配置的独立域名：</p>
<pre class="brush: plain; title: ; notranslate">

&lt;VirtualHost *:80&gt;
Options None
ServerAdmin 750881560@q.com
DocumentRoot d:\server\phpmyadmin
ServerName phpmyadmin.com
ErrorLog logs/phpmyadmin.com-error_log
CustomLog logs/phpmyadmin.com-access_log common
php_admin_value open_base_dir &quot;d:\servr\phpmyadmin;c:\windows\temp&quot;
&lt;/VirtualHost&gt;
</pre>
<p>注意：站点文件的位置一定要准确， Options None表明在网站根目录下没有默认的首页，将会出现404错误，去掉这一项，我们可以在没有首页的站点目录下以文件夹的形式浏览，如图：</p>
<p><a href="http://www.mudbest.com/874.action/5-5" rel="attachment wp-att-878"><img loading="lazy" decoding="async" src="http://www.mudbest.com/wp-content/uploads/2012/02/5-336x430.jpg" alt="" title="5" width="336" height="430" class="alignnone size-medium wp-image-878" srcset="https://www.mudbest.com/wp-content/uploads/2012/02/5-336x430.jpg 336w, https://www.mudbest.com/wp-content/uploads/2012/02/5.jpg 379w" sizes="auto, (max-width: 336px) 100vw, 336px" /></a></p>
<p>我们可以简化配置，如下：</p>
<pre class="brush: plain; title: ; notranslate">
&lt;VirtualHost *:80&gt;
DocumentRoot f:\www\guestbook
ServerName guestbook.com
php_admin_value open_base_dir &quot;f:\www\guestbook;c:\windows\temp&quot;
&lt;/VirtualHost&gt;
</pre>
<p>到这里，可以说是90%了，不过行百里半九十，继续完成最后一步吧</p>
<p>找到C:\Windows\System32\drivers\etc下面的hosts文件，在 127.0.0.1 localhost 后面加上你的配置：</p>
<p>127.0.0.1 localhost<br />
127.0.0.1 guestbook.com</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mudbest.com/apache%e9%85%8d%e7%bd%ae%e7%8b%ac%e7%ab%8b%e5%9f%9f%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Linux下Apache绑定多个域名的方法</title>
		<link>https://www.mudbest.com/linux%e4%b8%8bapache%e7%bb%91%e5%ae%9a%e5%a4%9a%e4%b8%aa%e5%9f%9f%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 26 Jan 2011 05:23:21 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<guid isPermaLink="false">http://blog.mudbest.com/?p=345</guid>

					<description><![CDATA[1、将#ServerName www.example.com:80修改成ServerName 94.249.1 ... <a title="Linux下Apache绑定多个域名的方法" class="read-more" href="https://www.mudbest.com/linux%e4%b8%8bapache%e7%bb%91%e5%ae%9a%e5%a4%9a%e4%b8%aa%e5%9f%9f%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95/" aria-label="阅读 Linux下Apache绑定多个域名的方法">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>1、将#ServerName www.example.com:80修改成ServerName 94.249.188.58:80，注意别忘记了将句首的#去掉；</p>
<p>2、将#NameVirtualHost *:80修改成NameVirtualHost 94.249.188.58:80，注意别忘记了将句首的#去掉；</p>
<p>3、在文件最后面有虚拟主机格式：<span id="more-345"></span></p>
<pre class="brush: plain; title: ; notranslate">
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
</pre>
<pre class="brush: plain; title: ; notranslate">
#*IP访问/var/www/html/dir目录

ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/dir
ServerName 127.0.0.1
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common

#*mudbest.com与www.mudbest.com访问/var/www/html/dir1目录

ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/dir1
ServerName mudbest.com
ServerAlias www.mudbest.com
ErrorLog logs/mudbest.com-error_log
CustomLog logs/mudbest.com-access_log common

#*mudbest.com与www.mudbest.com访问/var/www/html/dir2目录

ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/dir2
ServerName mudbest.com
ServerAlias www.mudbest.com
ErrorLog logs/mudbest.com-error_log
CustomLog logs/mudbest.com-access_log common
</pre>
<p>附：如果想开其他端口，请按照如下操作（以8080端口为例）：</p>
<p>1、打开http.conf，查找Listen 80，在下面一行添加Listen 8080；</p>
<p>2、在文件末尾添加如下代码：</p>
<pre class="brush: plain; title: ; notranslate">
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/dir3
ServerName mudbest.com
ServerAlias www.mudbest.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</pre>
<p>这样就将www.mudbest.com:8080绑定到/var/www/html/dir3目录了。</p>
<p>Apache<br />
Apache的“虚拟主机”，能够很好的支持多域名，绑定同一IP的某端口。<br />
具体如下：<br />
我要添加2个域名<br />
http://demo1.mudbest.com 指向 D:\web1\<br />
http://demo2.mudbest.com 指向 D:\web2\<br />
修改httpd.conf<br />
在文件最后找到</p>
<pre class="brush: plain; title: ; notranslate">
#NameVirtualHost
*:80
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
</pre>
<p>仿照上面的例子，在此之后，添加</p>
<pre class="brush: plain; title: ; notranslate">
NameVirtualHost
*:80

ServerName demo1.mudbest.com
DocumentRoot
&quot;D:/web1/&quot;

ServerName demo2.mudbest.com
DocumentRoot
&quot;D:/web2/&quot;
</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>linux下apache重启</title>
		<link>https://www.mudbest.com/linux%e4%b8%8bapache%e9%87%8d%e5%90%af/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 26 Jan 2011 03:43:37 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<guid isPermaLink="false">http://blog.mudbest.com/?p=343</guid>

					<description><![CDATA[apache服务，WEB端口在 1024以下的用  root 用户重启；1024的，使用指定用户重启即可！ 重 ... <a title="linux下apache重启" class="read-more" href="https://www.mudbest.com/linux%e4%b8%8bapache%e9%87%8d%e5%90%af/" aria-label="阅读 linux下apache重启">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>apache服务，WEB端口在 1024以下的用  root 用户重启；1024的，使用指定用户重启即可！</p>
<p>重启命令</p>
<pre class="brush: plain; title: ; notranslate">
apachectl restart
</pre>
<p>如果 apache安装在 /usr/local/apache<br />
<span id="more-343"></span><br />
那么命令就是</p>
<pre class="brush: plain; title: ; notranslate">
root#/usr/local/apache/bin/apachectl restart
</pre>
<p>或者</p>
<pre class="brush: plain; title: ; notranslate">
web$/usr/local/apache/bin/apachectl restart
</pre>
<p>还可以先进入 apache安装目录</p>
<pre class="brush: plain; title: ; notranslate">
cd /usr/local/apache
./apachectl restart
</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ubuntu Apache 基于域名的多站点设置</title>
		<link>https://www.mudbest.com/ubuntu-apache-%e5%9f%ba%e4%ba%8e%e5%9f%9f%e5%90%8d%e7%9a%84%e5%a4%9a%e7%ab%99%e7%82%b9%e8%ae%be%e7%bd%ae/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 24 Jan 2011 02:17:25 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[多域名]]></category>
		<guid isPermaLink="false">http://blog.mudbest.com/?p=339</guid>

					<description><![CDATA[在原始的apache上可使用localhost进行本地访问，但是如果想再利用 localhost访问全站，用w ... <a title="Ubuntu Apache 基于域名的多站点设置" class="read-more" href="https://www.mudbest.com/ubuntu-apache-%e5%9f%ba%e4%ba%8e%e5%9f%9f%e5%90%8d%e7%9a%84%e5%a4%9a%e7%ab%99%e7%82%b9%e8%ae%be%e7%bd%ae/" aria-label="阅读 Ubuntu Apache 基于域名的多站点设置">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>在原始的apache上可使用localhost进行本地访问，但是如果想再利用 localhost访问全站，用www.abc.com访问站点A，那就按照下面的步骤来操作：</p>
<p>/etc/apache2/sites-available/ 目录中建立一个文件 A。(这个名字可以随便取)</p>
<p>双击它，用编辑器打开，将一下内容复制到其中，部分地方需要修改。</p>
<pre class="brush: plain; title: ; notranslate">
&lt;VirtualHost *:80&gt;
#需要绑定的域名
ServerName mudbest.com
ServerAlias www.mudbest.com 
#管理员邮箱
ServerAdmin hkshadow@mudbest.com
#网站目录
DocumentRoot &quot;/var/www/blog/&quot;
#该网站的错误日志
ErrorLog &quot;/var/log/apache2/blog_errors.log&quot;
#改网站的配置日志
CustomLog &quot;/var/log/apache2/blog_accesses.log&quot; common
&lt;/VirtualHost&gt;
</pre>
<p>然后在命令行里并且在当前目录，输入 sudo a2ensite A ，这样就完成了A站点的配置了。</p>
<p>在网上看了那么多，好多都是不相干的说法，就这么简单。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
