<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[无情之家]]></title> 
<link>http://www.iuui.cn/index.php</link> 
<description><![CDATA[网站系统架构与程序开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[无情之家]]></copyright>
<item>
<link>http://www.iuui.cn/windows-apache-php/</link>
<title><![CDATA[Windows Apache安装配置及安全设置]]></title> 
<author>无情 &lt;wuqing@iuui.cn&gt;</author>
<category><![CDATA[Windows相关]]></category>
<pubDate>Sat, 07 May 2011 02:17:12 +0000</pubDate> 
<guid>http://www.iuui.cn/windows-apache-php/</guid> 
<description>
<![CDATA[ 
	下载Apache for windows<br/>httpd-2.2.17-win32-x86-no_ssl.msi: <a href="http://httpd.apache.org/download.cgi" target="_blank">http://httpd.apache.org/download.cgi</a><br/>下载PHP<br/>php-5.2.17-Win32-VC6-x86.zip: <a href="http://windows.php.net/download/" target="_blank">http://windows.php.net/download/</a><br/><br/>系统约定:<br/><div class="code">Apache安装目录: E:/Apache<br/>php目录: E:/Apache/php<br/>网站根目录: E:/wwwroot</div><br/><br/>安装Apache.<br/>解压PHP到Apache安装目录下.<br/>添加系统环境变量:<br/><div class="code">E:/Apache/php;E:/Apache/php/ext</div><br/><br/>打开httpd.conf<br/>1.添加默认主机<br/><div class="code">ServerName 127.0.0.1:80</div><br/>2.找到<br/><div class="code">#LoadModule vhost_alias_module modules/mod_vhost_alias.so</div><br/>在下面添加<br/><div class="code">LoadModule php5_module E:/Apache/php/php5apache2_2.dll<br/>&lt;IfModule mod_php5.c&gt;<br/>&nbsp;&nbsp;AddType application/x-httpd-php .php<br/>&lt;/IfModule&gt;</div><br/>3.查找E:/Apache/htdocs替换成E:/wwwroot<br/>4.在最下面添加<br/><div class="code">Include conf/extra/httpd-default.conf<br/>Include conf/extra/httpd-vhosts.conf<br/>Include conf/vhost/*.conf</div><br/><br/>打开conf/extra/httpd-vhosts.conf<br/>内容替换成<br/><div class="code">NameVirtualHost *:80<br/>&lt;VirtualHost *:80&gt;<br/>ServerAdmin wuqing@iuui.cn<br/>DocumentRoot &quot;E:/wwwroot&quot;<br/>ServerName localhost<br/>&lt;/VirtualHost&gt;</div><br/><br/>新建vhost目录<br/>需要添加虚拟主机就在vhost新建一个***.conf<br/>内容为<br/><div class="code">&lt;VirtualHost *:80&gt;<br/>ServerAdmin wuqing@iuui.cn<br/>DocumentRoot &quot;E:/wwwroot/test&quot;<br/>ServerName www.test.com<br/>&lt;/VirtualHost&gt;</div><br/><br/>此时安装配置已经完成,重启apache就生效.<br/><br/>安全配置:<br/><br/>停止Apache服务.<br/>新建一个Apache运行所使用的用户: apache(可不隶属于任何用户组).<br/>管理工具->本地安全设置->本地策略->用户权限分配->作为服务登录,添加一个apache用户.<br/>管理工具->服务,找到Apache服务,设置属性,登录用户选择受限用户(apache)输入受限用户的密码,应用,确定.<br/><br/>1.Apache所在的根目录(也就是这里的E盘),只需要读取的权限,并且这个读取权限不需要继承到子目录与文件(可以在权限设置高级里选择->应用到:只有该文件夹->权限: 列出文件夹/读取数据,读取属性,读取扩展属性,读取权限——确定).<br/>2.Apache安装目录需要"列出文件夹目录"和"读取"的权限(可以为了方便使用继承).<br/>如果Apache不是安装在磁盘根目录下,Apache安装目录的上级目录,需要"读取"的权限(和根目录E盘的权限相同).<br/>4.Apache目录下的bin,modules和php目录需要"读取和运行","列出文件夹和目录","读取"的权限.<br/>5.Apache目录下的logs目录需要"列出文件夹和目录","读取","写入"的权限.<br/>6.Apache目录下的htdocs设置"读取"和"写入"的权限.我们这里默认的目录是E:/wwwroot,所以次步可以忽略.<br/><br/>在本地机子上用来做测试基本是不用理会这些权限的,因为默认是使用系统用户来启动这个Apache服务的.不过若是暴露在外网就很危险了.安全是全方面的架构考虑,这里说的仅仅是冰山一角,不能以点盖面!<br/><br/>发现有遗漏的地方欢迎指正...<br/>Tags - <a href="http://www.iuui.cn/tags/windows/" rel="tag">windows</a> , <a href="http://www.iuui.cn/tags/apache/" rel="tag">apache</a> , <a href="http://www.iuui.cn/tags/php/" rel="tag">php</a>
]]>
</description>
</item><item>
<link>http://www.iuui.cn/windows-nginx-php/</link>
<title><![CDATA[Windows下nginx+php环境安装方法]]></title> 
<author>无情 &lt;wuqing@iuui.cn&gt;</author>
<category><![CDATA[Windows相关]]></category>
<pubDate>Wed, 13 Apr 2011 07:00:05 +0000</pubDate> 
<guid>http://www.iuui.cn/windows-nginx-php/</guid> 
<description>
<![CDATA[ 
	最近公司服务器由windows+iis转换成了linux+nginx,在程序移植到linux上的时候发现有些地方需要修改一下才正常,本地用的是windows2003,为了保证做的程序在服务器上能正常运行,所以我在本地做了一个nginx+php的环境.<br/><br/>软件版本: nginx -> 0.8.54 php -> 5.2.14<br/>下载地址: <a href="http://soft.befen.net/test/nginx.zip" target="_blank">http://soft.befen.net/test/nginx.zip</a><br/><br/>安装方法:<br/>解压nginx.zip到C盘,注意这里一定要C盘,不然无法运行,当然了,如果你懂的话可以修改路径.<br/>环境的启动关闭和重启操作可以运行nginx目录下的Server.bat,我已经做好了批处理.<br/>配置文件在nginx/conf/vhost/目录下,增加网站只要新建一个***.conf就行了.<br/>nginx目录下还有memcached目录,这个是memcached缓存系统,如果需要就打开cmd执行<br/><div class="code">C:&#92;nginx&#92;memcached&#92;memcached.exe -d install<br/>C:&#92;nginx&#92;memcached&#92;memcached.exe -d start</div><br/><br/>附上nginx的配置文件:<br/><div class="code">server &#123;<br/>&nbsp;&nbsp;listen 80;<br/>&nbsp;&nbsp;server_name www.iuui.cn;<br/>&nbsp;&nbsp;root F:/wwwroot;<br/><br/>&nbsp;&nbsp;#charset utf-8;<br/><br/>&nbsp;&nbsp;location / &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index.php;<br/>&nbsp;&nbsp;&#125;<br/><br/>&nbsp;&nbsp;location ~ &#92;.php$ &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_pass&nbsp;&nbsp; 127.0.0.1:9000;<br/>&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_index&nbsp;&nbsp;index.php;<br/>&nbsp;&nbsp;&nbsp;&nbsp;include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi.conf;<br/>&nbsp;&nbsp;&#125;<br/>&#125;</div><br/>Tags - <a href="http://www.iuui.cn/tags/windows/" rel="tag">windows</a> , <a href="http://www.iuui.cn/tags/nginx/" rel="tag">nginx</a> , <a href="http://www.iuui.cn/tags/php/" rel="tag">php</a>
]]>
</description>
</item><item>
<link>http://www.iuui.cn/php-charset/</link>
<title><![CDATA[PHP字符集转换函数]]></title> 
<author>无情 &lt;wuqing@iuui.cn&gt;</author>
<category><![CDATA[PHP/JS/Shell]]></category>
<pubDate>Wed, 13 Apr 2011 07:00:04 +0000</pubDate> 
<guid>http://www.iuui.cn/php-charset/</guid> 
<description>
<![CDATA[ 
	使用方法:<br/><br/><div class="code">&lt;?php<br/><br/>$str = &#039;这里是需要格式的字符串&#039;;<br/>$new_str = phpcharset($str, &#039;GBK&#039;);<br/>echo $new_str;<br/><br/>function phpcharset($data, $to) &#123;<br/>&nbsp;&nbsp;$encode_array = array(&#039;ASCII&#039;, &#039;UTF-8&#039;, &#039;GBK&#039;, &#039;GB2312&#039;, &#039;BIG5&#039;);<br/>&nbsp;&nbsp;$encoded = mb_detect_encoding($data, $encode_array);<br/>&nbsp;&nbsp;$data = mb_convert_encoding($data, $to, $encoded);<br/>&nbsp;&nbsp;return $data;<br/>&#125;<br/><br/>?&gt;</div><br/><br/>GBK字符集下,我做中文伪静态的时候,用非转义url格式网页出现乱码.<br/>我查了查,是因为GET下来的字符串默认是UTF-8,最后就使用了这个函数就解决了.<br/>其实很简单,就是使用了PHP下的mb_convert_encoding函数,我扩展了一下,支持四种字符集转换,所以PHP必须支持mb_convert_encoding函数. <br/>Tags - <a href="http://www.iuui.cn/tags/php/" rel="tag">php</a> , <a href="http://www.iuui.cn/tags/charset/" rel="tag">charset</a>
]]>
</description>
</item><item>
<link>http://www.iuui.cn/linux-memcached/</link>
<title><![CDATA[Linux安装memcached缓存系统]]></title> 
<author>无情 &lt;wuqing@iuui.cn&gt;</author>
<category><![CDATA[缓存技术]]></category>
<pubDate>Tue, 12 Apr 2011 07:00:03 +0000</pubDate> 
<guid>http://www.iuui.cn/linux-memcached/</guid> 
<description>
<![CDATA[ 
	Memcached 是一个高性能的分布式内存对象缓存系统，用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数，从而提供动态、数据库驱动网站的速度。Memcached基于一个存储键/值对的hashmap。其守护进程（daemon ）是用C写的，但是客户端可以用任何语言来编写，并通过memcached协议与守护进程通信。但是它并不提供冗余（例如，复制其hashmap条目）；当某个服务器S停止运行或崩溃了，所有存放在S上的键/值对都将丢失。<br/><br/>下面是安装方法：<br/>wget -c http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz<br/>tar zxvf&nbsp;&nbsp;memcached-1.4.5.tar.gz<br/>cd memcached-1.4.5<br/>./configure --prefix=/usr/local/memcached --with-libevent<br/>make && make install<br/>ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2<br/>设置开机启动：<br/>vi /etc/rc.d/rc.local<br/>下面增加一行：<br/>/usr/local/memcached/bin/memcached -d -m 64 -u root -l 127.0.0.1 -p 11211 -c 128 -P /tmp/memcached.pid <br/>Tags - <a href="http://www.iuui.cn/tags/linux/" rel="tag">linux</a> , <a href="http://www.iuui.cn/tags/memcached/" rel="tag">memcached</a>
]]>
</description>
</item><item>
<link>http://www.iuui.cn/nginx-for-linux/</link>
<title><![CDATA[Nginx For Linux安装]]></title> 
<author>无情 &lt;wuqing@iuui.cn&gt;</author>
<category><![CDATA[Web服务器]]></category>
<pubDate>Tue, 12 Apr 2011 07:00:02 +0000</pubDate> 
<guid>http://www.iuui.cn/nginx-for-linux/</guid> 
<description>
<![CDATA[ 
	wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz<br/>tar zxvf pcre-8.10.tar.gz<br/>cd pcre-8.10/<br/>./configure<br/>make && make install<br/>cd ../<br/><br/>groupadd www<br/>useradd -g www www<br/>mkdir -p /home/wwwroot<br/>chmod +w /home/wwwroot<br/><br/>wget http://www.nginx.org/download/nginx-0.8.54.tar.gz<br/>tar zxvf nginx-0.8.54.tar.gz<br/>cd nginx-0.8.54/<br/>./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6<br/>make && make install<br/>cd ../<br/>Tags - <a href="http://www.iuui.cn/tags/nginx/" rel="tag">nginx</a> , <a href="http://www.iuui.cn/tags/linux/" rel="tag">linux</a>
]]>
</description>
</item><item>
<link>http://www.iuui.cn/nginx-rewrite-for-boblog/</link>
<title><![CDATA[博客系统Bo-Blog 2.1.1的Nginx Rewrite]]></title> 
<author>无情 &lt;wuqing@iuui.cn&gt;</author>
<category><![CDATA[Web服务器]]></category>
<pubDate>Tue, 12 Apr 2011 07:00:01 +0000</pubDate> 
<guid>http://www.iuui.cn/nginx-rewrite-for-boblog/</guid> 
<description>
<![CDATA[ 
	Bo-Blog是一款采用PHP开发的单用户博客程序，本人的博客也采用的是Bo-Blog，个人觉得bo-blog的排版、易用性要比WordPress好得多，但扩展性不如WordPress。<br/><br/>Bo-Blog 2.1.1 的 Nginx Rewrite 重写规则：<br/><br/><div class="code">if (!-e $request_filename)<br/>&#123;<br/>&nbsp;&nbsp;rewrite ^/post/(&#91;0-9&#93;+)/?(&#91;0-9&#93;+)?/?(&#91;0-9&#93;+)?/?$ /read.php?entryid=$1&amp;page=$2&amp;part=$3 last;<br/>&nbsp;&nbsp;rewrite ^/page/(&#91;0-9&#93;+)/(&#91;0-9&#93;+)/?$ /index.php?mode=$1&amp;page=$2 last;<br/>&nbsp;&nbsp;rewrite ^/starred/(&#91;0-9&#93;+)/?(&#91;0-9&#93;+)?/?$ /star.php?mode=$1&amp;page=$2 last;<br/>&nbsp;&nbsp;rewrite ^/category/(&#91;^/&#93;+)/?(&#91;0-9&#93;+)?/?(&#91;0-9&#93;+)?/?$ /index.php?go=category_$1&amp;mode=$2&amp;page=$3 last;<br/>&nbsp;&nbsp;rewrite ^/archiver/(&#91;0-9&#93;+)/(&#91;0-9&#93;+)/?(&#91;0-9&#93;+)?/?(&#91;0-9&#93;+)?/?$ /index.php?go=archive&amp;cm=$1&amp;cy=$2&amp;mode=$3&amp;page=$4 last;<br/>&nbsp;&nbsp;rewrite ^/date/(&#91;0-9&#93;+)/(&#91;0-9&#93;+)/(&#91;0-9&#93;+)/?(&#91;0-9&#93;+)?/?(&#91;0-9&#93;+)?/?$ /index.php?go=showday_$1-$2-$3&amp;mode=$4&amp;page=$5 last;<br/>&nbsp;&nbsp;rewrite ^/user/(&#91;0-9&#93;+)/?$ /view.php?go=user_$1 last;<br/>&nbsp;&nbsp;rewrite ^/tags/(&#91;^/&#93;+)/?(&#91;0-9&#93;+)?/?(&#91;0-9&#93;+)?/?$ /tag.php?tag=$1&amp;mode=$2&amp;page=$3 last;<br/>&nbsp;&nbsp;rewrite ^/component/id/(&#91;0-9&#93;+)/?$ /page.php?pageid=$1 last;<br/>&nbsp;&nbsp;rewrite ^/component/(&#91;^/&#93;+)/?$ /page.php?pagealias=$1 last;<br/><br/>&nbsp;&nbsp;#Force redirection for old rules<br/>&nbsp;&nbsp;rewrite ^/read&#92;.php/(&#91;0-9&#93;+)&#92;.htm$ http://$host/post/$1/ permanent;<br/>&nbsp;&nbsp;rewrite ^/post/(&#91;0-9&#93;+)&#92;.htm$ http://$host/post/$1/ permanent;<br/>&nbsp;&nbsp;rewrite ^/post/(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/post/$1/$2/ permanent;<br/>&nbsp;&nbsp;rewrite ^/post/(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/post/$1/$2/$3/ permanent;<br/>&nbsp;&nbsp;rewrite ^/index&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/page/$1/$2/ permanent;<br/>&nbsp;&nbsp;rewrite ^/star&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/starred/$1/$2/ permanent;<br/>&nbsp;&nbsp;rewrite ^/category&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/category/$1/ permanent;<br/>&nbsp;&nbsp;rewrite ^/category&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/category/$1/$2/$3/ permanent;<br/>&nbsp;&nbsp;rewrite ^/archive&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/archiver/$1/$2/ permanent;<br/>&nbsp;&nbsp;rewrite ^/archive&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/archiver/$1/$2/$3/$4/ permanent;<br/>&nbsp;&nbsp;rewrite ^/showday&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/date/$1/$2/$3/ permanent;<br/>&nbsp;&nbsp;rewrite ^/showday&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;_(&#91;0-9&#93;+)&#92;.htm$ http://$host/date/$1/$2/$3/$4/$5/ permanent;<br/><br/>&nbsp;&nbsp;#Filename alias<br/>&nbsp;&nbsp;rewrite ^/(&#91;a-zA-Z0-9_-&#93;+)/?(&#91;0-9&#93;+)?/?(&#91;0-9&#93;+)?/?$ /read.php?blogalias=$1&amp;page=$2&amp;part=$3 last;<br/>&#125;</div><br/>Tags - <a href="http://www.iuui.cn/tags/nginx/" rel="tag">nginx</a> , <a href="http://www.iuui.cn/tags/rewrite/" rel="tag">rewrite</a>
]]>
</description>
</item>
</channel>
</rss>
