<?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>老谢博客</title>
	<atom:link href="http://www.xj123.info/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xj123.info</link>
	<description>xj123.info &#124; Rural migrant workers</description>
	<lastBuildDate>Wed, 08 Feb 2012 01:13:26 +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>thinkpad x220i简单试用</title>
		<link>http://www.xj123.info/2393.html</link>
		<comments>http://www.xj123.info/2393.html#comments</comments>
		<pubDate>Tue, 07 Feb 2012 14:48:43 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[乱七八糟]]></category>
		<category><![CDATA[thinkpad x200i]]></category>
		<category><![CDATA[小黑]]></category>
		<category><![CDATA[试用]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2393</guid>
		<description><![CDATA[价格：5400 国行 带票 用途：妹纸学习、娱乐 cpu系列号: i3-2350M 内存大小: 2 GB 内存技术: DDR3 显示最大分辨率: 1366 x 768 显示屏尺寸: 12.5 英寸 显示屏类型: LED 显示芯片: 英特尔 HD 3000显示芯片 显卡描述: 集成显卡 显卡厂商: intel 硬盘容量: 320 GB 硬盘描述: SATA 材质: 镁合金＋ABS材料 网络描述: ThinkPad BGN 外观篇 屏幕木有卡扣，一点小小的不习惯，左侧两个usb口，不是放在一起，也有点小小的不习惯。 关于贴标，唉，不说了，肯定是临时工贴的，扭扭歪歪的。 电源接口依旧在后面，其实我觉得还是设计在侧面，使用起来更方便。 屏幕篇 1336*768分辨率在12寸的屏幕上，画面非常细腻，看起来非常爽， 比现在使用的t410的1280*800要舒服，虽然是带鱼屏，但仍然可以忍受，老谢已经准备下个月把t410换成1440*900高分屏了，高分看起来太舒服了，诱惑完全挡不住！ 性能篇 i3-2350M，双核四线程，2.3G主频，完全足矣应付office以及常见网游，2G内存有点小小的不足，京东购买的3*4G内存配送中&#8230;. 显卡HD3000，性能还算不错，日常网游足矣应付，由于新本本是给妹纸用的，妹纸只玩玩梦幻，完全无压力！ 关于显卡，更详细的测试可以看：http://www.dhsoo.com/index.php/archives/126.html 机器的散热也是非常棒的，在床上玩了大约2小时，cpu温度仅35°，室内开了空调，室温大概15°左右。 撸大湿的评分为：2356，等3*4g内存插上，应该能跑到2500分左右，总之妹纸使用，足矣~~！x220的性能还是蛮好的。 最后的牢骚 x系列小巧的身材，非常容易让人产生爱不释手的感觉，并且不弱的性能，一般也足矣满足死宅旅游在外或者出差等外出的使用需求 6芯的电池，续航大概在4小时左右，我的性能设置为均衡，散热模式为被动，屏幕亮度12，使用无线网卡 购买的型号木有指纹，算是个遗憾了，t410的指纹冷启动，把我惯坏了 [...]]]></description>
			<content:encoded><![CDATA[<p>价格：5400 国行 带票<br />
用途：妹纸学习、娱乐</p>
<blockquote><p>
cpu系列号:	i3-2350M<br />
内存大小:	2 GB<br />
内存技术:	DDR3<br />
显示最大分辨率:	1366 x 768<br />
显示屏尺寸:	12.5 英寸<br />
显示屏类型:	LED<br />
显示芯片:	英特尔 HD 3000显示芯片<br />
显卡描述:	集成显卡<br />
显卡厂商:	intel<br />
硬盘容量:	320 GB<br />
硬盘描述:	SATA<br />
材质:	镁合金＋ABS材料<br />
网络描述:	ThinkPad BGN
</p></blockquote>
<p><span id="more-2393"></span></p>
<h5>外观篇</h5>
<p>屏幕木有卡扣，一点小小的不习惯，左侧两个usb口，不是放在一起，也有点小小的不习惯。<br />
关于贴标，唉，不说了，肯定是临时工贴的，扭扭歪歪的。<br />
电源接口依旧在后面，其实我觉得还是设计在侧面，使用起来更方便。</p>
<h5>屏幕篇</h5>
<p>1336*768分辨率在12寸的屏幕上，画面非常细腻，看起来非常爽，<br />
比现在使用的t410的1280*800要舒服，虽然是带鱼屏，但仍然可以忍受，老谢已经准备下个月把t410换成1440*900高分屏了，高分看起来太舒服了，诱惑完全挡不住！</p>
<h5>性能篇</h3>
<p>i3-2350M，双核四线程，2.3G主频，完全足矣应付office以及常见网游，2G内存有点小小的不足，京东购买的3*4G内存配送中&#8230;.<br />
显卡HD3000，性能还算不错，日常网游足矣应付，由于新本本是给妹纸用的，妹纸只玩玩梦幻，完全无压力！<br />
<em>关于显卡，更详细的测试可以看：http://www.dhsoo.com/index.php/archives/126.html</em><br />
机器的散热也是非常棒的，在床上玩了大约2小时，cpu温度仅35°，室内开了空调，室温大概15°左右。<br />
撸大湿的评分为：2356，等3*4g内存插上，应该能跑到2500分左右，总之妹纸使用，足矣~~！x220的性能还是蛮好的。</p>
<h5>最后的牢骚</h5>
<p>x系列小巧的身材，非常容易让人产生爱不释手的感觉，并且不弱的性能，一般也足矣满足死宅旅游在外或者出差等外出的使用需求<br />
6芯的电池，续航大概在4小时左右，我的性能设置为均衡，散热模式为被动，屏幕亮度12，使用无线网卡<br />
购买的型号木有指纹，算是个遗憾了，t410的指纹冷启动，把我惯坏了</p>
<p>ps：对联想有点无语，居然预装QQ软件管家和百度搜索插件以及诺顿。。败掉了</p>
<p>附图一张：</p>
<p><a href="http://laoxie-upload.stor.sinaapp.com/thinkpad-x220i.jpg"><img src="http://laoxie-upload.stor.sinaapp.com/thinkpad-x220i.jpg" alt="thinkpad x220i简单试用" title="thinkpad X220i" width="800" hight="600"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2393.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>转载：SolusVM提供的API让我用烂手机wap功能管理VPS</title>
		<link>http://www.xj123.info/2386.html</link>
		<comments>http://www.xj123.info/2386.html#comments</comments>
		<pubDate>Tue, 07 Feb 2012 03:52:43 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[SolusVM]]></category>
		<category><![CDATA[SolusVM API]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2386</guid>
		<description><![CDATA[以下代码转自：http://dao.daimaku.com 老谢的烂手机终于也能简单的操作vps了，有个重启功能足矣，诺基亚继续坚挺着 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 [...]]]></description>
			<content:encoded><![CDATA[<p>以下代码转自：<a href="http://dao.daimaku.com" title="用SolusVM提供的API让我用烂手机wap功能管理VPS" target="_blank">http://dao.daimaku.com</a></p>
<p>老谢的烂手机终于也能简单的操作vps了，有个重启功能足矣，诺基亚继续坚挺着</p>
<p><span id="more-2386"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span> ^ <span style="color: #009900; font-weight: bold;">E_NOTICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$sure</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sure'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'boot'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$action</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sure</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'您确定要启动VPS吗？&lt;a href=&quot;vps?action=boot&amp;sure=1&quot;&gt;确定&lt;/a&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'reboot'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$action</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sure</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'您确定要重新启动VPS吗？&lt;a href=&quot;vps?action=reboot&amp;sure=1&quot;&gt;确定&lt;/a&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$action</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'status'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$action</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'boot'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$action</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'reboot'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;操作错误！&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;API KEY 在控制面板可获取&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$hash</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;API HASH 在控制面板可获取&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://SolusVM管理地址/api/client/command.php?key=<span style="color: #006699; font-weight: bold;">$key</span>&amp;hash=<span style="color: #006699; font-weight: bold;">$hash</span>&amp;action=<span style="color: #006699; font-weight: bold;">$action</span>&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Parse the returned data and build an array</span>
&nbsp;
        <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;(.*?)&gt;([^&lt;]+)&lt;\/\\1&gt;/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$match</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$x</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$y</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//错误信息</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;status&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;statusmsg&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;status&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;statusmsg&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;online&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The virtual server is online!&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;statusmsg&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;offline&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The virtual server is offline!&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;statusmsg&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;rebooted&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The virtual server has been rebooted!&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;statusmsg&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;shutdown&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The virtual server has been shutdown!&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;statusmsg&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;booted&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The virtual server has been booted!&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Status message unknown!&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;hr&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC &quot;-//WAPFORUM//DTD XHTML Mobile 1.0//EN&quot; &quot;http://www.wapforum.org/DTD/xhtml-mobile10.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;application/xhtml+xml;charset=UTF-8&quot;/&gt;
&lt;meta http-equiv=&quot;Cache-control&quot; content=&quot;no-cache&quot; /&gt;
&lt;title&gt;VPS管理&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;vps.php?action=status&quot;&gt;查看状态&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;vps.php?action=boot&quot;&gt;启动VPS&lt;/a&gt; &lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;vps.php?action=reboot&quot;&gt;重启VPS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2386.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>监控apache虚拟主机进程</title>
		<link>http://www.xj123.info/2377.html</link>
		<comments>http://www.xj123.info/2377.html#comments</comments>
		<pubDate>Fri, 03 Feb 2012 12:06:14 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[apache虚拟主机]]></category>
		<category><![CDATA[mod_status]]></category>
		<category><![CDATA[监控apache]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2377</guid>
		<description><![CDATA[mod_status模块能输出如下内容： 正在伺服请求的工作者(线程或进程)数量 空闲的工作者数量 每个工作者的状态：已完成的请求数、已发送的字节数。(*) 总访问数和已发送的字节总数(*) 服务器自启动/重启以来经过的时间，服务器已经运行的时间。 平均每秒请求数，平均每秒发送的字节数，平均每个请求发送的字节数。(*) 每个工作者的当前CPU使用百分率，以及Apache的当前总计CPU使用百分率。(*) 当前正在被处理的主机和请求(*) 检测是否加载mod_status模块 1 httpd -M 如果有status_module (shared)，则表示已经加载mod_status模块，请略过下面安装mod_status模块的内容 1 2 3 4 cd /lamp/httpd-2.2.20/modules/generators /usr/local/apache/bin/apxs -i -a -c mod_status.c service httpd restart httpd -M #验证是否成功加载 编辑httpd.conf，加入以下代码 1 2 3 4 5 6 7 ExtendedStatus On &#60;Location /server-status&#62; SetHandler server-status Order Deny,Allow Deny from All Allow from All &#60;/Location&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>mod_status模块能输出如下内容：</p>
<blockquote>
<ul>
<li>正在伺服请求的工作者(线程或进程)数量</li>
<li>空闲的工作者数量</li>
<li>每个工作者的状态：已完成的请求数、已发送的字节数。(*)</li>
<li>总访问数和已发送的字节总数(*)</li>
<li>服务器自启动/重启以来经过的时间，服务器已经运行的时间。</li>
<li>平均每秒请求数，平均每秒发送的字节数，平均每个请求发送的字节数。(*)</li>
<li>每个工作者的当前CPU使用百分率，以及Apache的当前总计CPU使用百分率。(*)</li>
<li>当前正在被处理的主机和请求(*)</li>
</ul>
</blockquote>
<p><span id="more-2377"></span><br />
检测是否加载mod_status模块</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">httpd <span style="color: #660033;">-M</span></pre></td></tr></table></div>

<p>如果有status_module (shared)，则表示已经加载mod_status模块，请略过下面安装mod_status模块的内容</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>lamp<span style="color: #000000; font-weight: bold;">/</span>httpd-2.2.20<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>generators
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>apxs <span style="color: #660033;">-i</span> <span style="color: #660033;">-a</span> <span style="color: #660033;">-c</span> mod_status.c
service httpd restart
httpd <span style="color: #660033;">-M</span> <span style="color: #666666; font-style: italic;">#验证是否成功加载</span></pre></td></tr></table></div>

<p>编辑httpd.conf，加入以下代码</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">ExtendedStatus</span> <span style="color: #0000ff;">On</span>
&lt;<span style="color: #000000; font-weight:bold;">Location</span> /server-status&gt;
<span style="color: #00007f;">SetHandler</span> server-status
<span style="color: #00007f;">Order</span> <span style="color: #00007f;">Deny</span>,<span style="color: #00007f;">Allow</span>
<span style="color: #00007f;">Deny</span> from <span style="color: #0000ff;">All</span>
<span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">All</span>
&lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;</pre></td></tr></table></div>

<p>然后你就可以通过http://your.server.name/server-status来查看页面报告了，也可以通过http://your.server.name/server-status?refresh=N隔N秒刷新页面，这样就可以达到实时监控了。</p>
<p><a href="http://laoxie-upload.stor.sinaapp.com/apache_status_mod.jpg" title="apache_status_mod"><img src="http://laoxie-upload.stor.sinaapp.com/apache_status_mod.jpg" alt="监控apache虚拟主机进程" title="apache_status_mod" ></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2377.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>iftop提示Unable to get IP address for interface</title>
		<link>http://www.xj123.info/2356.html</link>
		<comments>http://www.xj123.info/2356.html#comments</comments>
		<pubDate>Wed, 25 Jan 2012 04:48:53 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[iftop]]></category>
		<category><![CDATA[Unable to get IP address for interface]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2356</guid>
		<description><![CDATA[为了更清楚的了解vps流量，于是乎安装了iftop，编译安装完了以后，执行iftop，提示如下 [root@vps iftop-0.17]# iftop interface: tunl0 Unable to get IP address for interface: tunl0 ioctl(SIOCGIFADDR): Cannot assign requested address MAC address is: 00:00:00:00:00:00 pcap_open_live(tunl0): bind: Network is down 提示的大意为获取不到网卡的ip，网上搜索一番，得知可能是名卡名的问题，要解决问题很简单，找到正确的网卡名就ok了！ 执行ifconfig找到配置有vps外网ip的网卡名，如下图所示： 找到正确的网卡，然后执行iftop -i 网卡名即可！]]></description>
			<content:encoded><![CDATA[<p>为了更清楚的了解vps流量，于是乎安装了iftop，编译安装完了以后，执行iftop，提示如下</p>
<blockquote><p>
[root@vps iftop-0.17]# iftop<br />
interface: tunl0<br />
Unable to get IP address for interface: tunl0<br />
ioctl(SIOCGIFADDR): Cannot assign requested address<br />
MAC address is: 00:00:00:00:00:00<br />
pcap_open_live(tunl0): bind: Network is down
</p></blockquote>
<p>提示的大意为获取不到网卡的ip，网上搜索一番，得知可能是名卡名的问题，要解决问题很简单，找到正确的网卡名就ok了！</p>
<p>执行<em>ifconfig</em>找到配置有vps外网ip的网卡名，如下图所示：</p>
<p><span id="more-2356"></span><br />
<a href="http://laoxie-upload.stor.sinaapp.com/iftop_venet.jpg"><img src="http://laoxie-upload.stor.sinaapp.com/iftop_venet.jpg" alt="iftop提示Unable to get IP address for interface" /></a></p>
<p>找到正确的网卡，然后执行<em>iftop -i 网卡名</em>即可！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2356.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>CentOS PPTP配置FreeRADIUS+DaloRADIUS实现高级用户控制+流量控制</title>
		<link>http://www.xj123.info/2323.html</link>
		<comments>http://www.xj123.info/2323.html#comments</comments>
		<pubDate>Tue, 24 Jan 2012 05:44:44 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[DaloRADIUS]]></category>
		<category><![CDATA[FreeRADIUS]]></category>
		<category><![CDATA[FreeRADIUSX流量控制]]></category>
		<category><![CDATA[PPTP]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2323</guid>
		<description><![CDATA[前提条件 阅读本文前，您需要搭建好PPTP，如果仍为搭建，可以参考：http://www.xj123.info/2301.html 如果您需要配置DaloRADIUS，那么您还需要安装LAMP，可以参考：http://www.xj123.info/2223.html PPP：Point-to-Point Protocol，点对点协议，是工作在数据链路层的连接协议。常见的ADSL连接时使用的PPPoE便是指的以太网上的点对点协议（Point-to-Point Protocol over Ethernet）。而我们创建连接VPN时也会通过PPP来进行，*nix操作系统上的pppd能够完成这一任务，其进行用户验证的默认方法便是chap-secrets文件。配置完FreeRADIUS后，我们需要把用户验证这一环节交给RADIUS服务器来完成。 RADIUS：Remote Authentication Dial In User Service，远程用户拨号验证服务，基于RFC2865和RFC2866。具体的工作原理挺复杂的，仔细阅读这两个RFC标准应该可以搞明白。简单的说，它是一个兼顾验证（authentication）、授权（authorization）及记账（accounting）三种服务的协议，即AAA协议。RADIUS运行在应用层，使用UDP进行传输，它被广泛用于ISP和企业用来控制Internet或内部网络、无线网络的访问。 FreeRADIUS：是一个实现RADIUS协议的软件，基于GPLv2开源。它是目前部署最广泛的开源RADIUS软件。 daloRADIUS：是一个FreeRADIUS的Web挂历程序，使用PHP编写。 安装配置 1 yum install freeradius2 freeradius2-mysql freeradius2-utils 安装完以后，编辑/etc/raddb/users，加上 testing Cleartext-Password := “password” 打开radius的测试模式，执行radiusd -X，然后打开一个新终端，执行radtest testing password 127.0.0.1 0 testing123，如果看到Access-Accept，说明没问题，如果没看到，返回去检查。 测试连接成功后，我们可以把users里临时加上去的第一行删除。 下载ppp源码 1 2 3 wget ftp://ftp.samba.org/pub/ppp/ppp-2.4.5.tar.gz tar zxvf ppp-2.4.5.tar.gz cp -R /root/ppp-2.4.5/pppd/plugins/radius/etc/ /usr/local/etc/radiusclient 编辑/usr/local/etc/radiusclient/servers，加上一组服务器和密钥，本例中为“LaoxieVPN” 1 localhost LaoxieVPN 编辑/usr/local/etc/radiusclient/dictionary 最后一行改成INCLUDE [...]]]></description>
			<content:encoded><![CDATA[<h5>前提条件</h5>
<h3>阅读本文前，您需要搭建好PPTP，如果仍为搭建，可以参考：<a href="http://www.xj123.info/2301.html">http://www.xj123.info/2301.html</a></h3>
<h3>如果您需要配置DaloRADIUS，那么您还需要安装LAMP，可以参考：<a href="http://www.xj123.info/2223.html">http://www.xj123.info/2223.html</a></h3>
<blockquote><p>
PPP：Point-to-Point Protocol，点对点协议，是工作在数据链路层的连接协议。常见的ADSL连接时使用的PPPoE便是指的以太网上的点对点协议（Point-to-Point Protocol over Ethernet）。而我们创建连接VPN时也会通过PPP来进行，*nix操作系统上的pppd能够完成这一任务，其进行用户验证的默认方法便是chap-secrets文件。配置完FreeRADIUS后，我们需要把用户验证这一环节交给RADIUS服务器来完成。</p>
<p>RADIUS：Remote Authentication Dial In User Service，远程用户拨号验证服务，基于RFC2865和RFC2866。具体的工作原理挺复杂的，仔细阅读这两个RFC标准应该可以搞明白。简单的说，它是一个兼顾验证（authentication）、授权（authorization）及记账（accounting）三种服务的协议，即AAA协议。RADIUS运行在应用层，使用UDP进行传输，它被广泛用于ISP和企业用来控制Internet或内部网络、无线网络的访问。</p>
<p>FreeRADIUS：是一个实现RADIUS协议的软件，基于GPLv2开源。它是目前部署最广泛的开源RADIUS软件。</p>
<p>daloRADIUS：是一个FreeRADIUS的Web挂历程序，使用PHP编写。
</p></blockquote>
<p><span id="more-2323"></span></p>
<h5>安装配置</h5>
<p></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> freeradius2 freeradius2-mysql freeradius2-utils</pre></td></tr></table></div>

<p>安装完以后，编辑/etc/raddb/users，加上<br />
<h3>testing Cleartext-Password := “password”</h3>
<p><em>打开radius的测试模式，执行radiusd -X，然后打开一个新终端，执行radtest testing password 127.0.0.1 0 testing123，如果看到Access-Accept，说明没问题，如果没看到，返回去检查。</em><br />
<em>测试连接成功后，我们可以把users里临时加上去的第一行删除。</em></p>
<p><em>下载ppp源码</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.samba.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>ppp<span style="color: #000000; font-weight: bold;">/</span>ppp-2.4.5.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf ppp-2.4.5.tar.gz
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>ppp-2.4.5<span style="color: #000000; font-weight: bold;">/</span>pppd<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>radius<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>radiusclient</pre></td></tr></table></div>

<p><em>编辑/usr/local/etc/radiusclient/servers，加上一组服务器和密钥，本例中为“LaoxieVPN”</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">localhost LaoxieVPN</pre></td></tr></table></div>

<p><em>编辑/usr/local/etc/radiusclient/dictionary</em></p>
<h3>最后一行改成INCLUDE /usr/local/etc/radiusclient/dictionary.microsoft，然后添加一行INCLUDE /usr/local/etc/radiusclient/dictionary.merit</h3>
<p><em>编辑/etc/raddb/clients.conf</em></p>
<h3>把client localhost段下的secret改成刚才指定的密钥。</h3>
<p><em>编辑/etc/raddb/radiusd.conf，找到$INCLUDE sql.conf，去掉前面的#；找到$INCLUDE sql/mysql/counter.conf，去掉前面的#。</em></p>
<p><em>进入mysql，添加数据库</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">database</span> radius<span style="color: #000033;">;</span>
flush <span style="color: #990099; font-weight: bold;">privileges</span><span style="color: #000033;">;</span>
exit<span style="color: #000033;">;</span></pre></td></tr></table></div>

<p><em>编辑/etc/raddb/sql.conf，配置login（用户名），password（密码），radius_db（数据库名）等字段，并找到readclients一行，设为yes并去掉注释符号#。</em></p>
<p><em>编辑/etc/raddb/sites-enabled/default，根据下面的说明注释或取消注释相应的行：</em></p>
<ul>
<li>authorize段，关掉files，打开sql，也可以把unix关掉</li>
<li>preacct段，关掉files</li>
<li>accounting段，打开sql，也可以把unix关掉</li>
<li>session段，打开sql</li>
<li>post-auth段，打开sql</li>
<li>pre-proxy段，关掉files</li>
</ul>
<p><em>到这一步，我们的FreeRADIUS就算配置好了，用户信息都将保存在MySQL数据库中。至于数据库中的表，我们在后面统一导入。</em></p>
<p><em>配置DaloRADIUS</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>projects<span style="color: #000000; font-weight: bold;">/</span>daloradius<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>daloradius<span style="color: #000000; font-weight: bold;">/</span>daloradius-<span style="color: #000000;">0.9</span>-<span style="color: #000000;">8</span><span style="color: #000000; font-weight: bold;">/</span>daloradius-<span style="color: #000000;">0.9</span>-<span style="color: #000000;">8</span>.tar.gz
pear <span style="color: #c20cb9; font-weight: bold;">install</span> DB
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>daloRadius
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf daloradius-<span style="color: #000000;">0.9</span>-<span style="color: #000000;">8</span>.tar.gz
<span style="color: #c20cb9; font-weight: bold;">mv</span> daloradius-<span style="color: #000000;">0.9</span>-<span style="color: #000000;">8</span><span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>daloRadius<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-r</span> daloradius-<span style="color: #000000;">0.9</span>-<span style="color: #000000;">8</span></pre></td></tr></table></div>

<h3>注意，这里需要安装pear，如果bash提示找不到命令，那么请自行google安装方法</h3>
<p><em>下面导入数据库</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;">mysql <span style="color: #CC0099;">-</span>uroot <span style="color: #CC0099;">-</span>p radius <span style="color: #CC0099;">&lt;</span> <span style="color: #CC0099;">/</span>usr<span style="color: #CC0099;">/</span>share<span style="color: #CC0099;">/</span>daloRadius<span style="color: #CC0099;">/</span>contrib<span style="color: #CC0099;">/</span>db<span style="color: #CC0099;">/</span>fr2<span style="color: #CC0099;">-</span>mysql<span style="color: #CC0099;">-</span>daloradius<span style="color: #CC0099;">-</span>and<span style="color: #CC0099;">-</span>freeradius.sql</pre></td></tr></table></div>

<p><em>编辑/usr/share/daloRadius/library/daloradius.conf.php，修改daloRADIUS的配置文件。首先是MySQL登录信息：</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$configValues</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'CONFIG_DB_HOST'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$configValues</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'CONFIG_DB_USER'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'radius'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//根据自己实际情况填写</span>
<span style="color: #000088;">$configValues</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'CONFIG_DB_PASS'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 设为自己的密码</span>
<span style="color: #000088;">$configValues</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'CONFIG_DB_NAME'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'radius'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>下面有一个daloRADIUS的bug，默认配置中有一个表名和我们导入的不一样，把它改过来：</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$configValues</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'CONFIG_DB_TBL_RADUSERGROUP'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'radusergroup'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>然后修改daloRADIUS的路径：</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$configValues</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'CONFIG_PATH_DALO_VARIABLE_DATA'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/usr/share/daloRadius/var'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><em>网页目录下建目录链接</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>daloRadius<span style="color: #000000; font-weight: bold;">/</span> admin</pre></td></tr></table></div>

<h3>daloRADIUS管理页面地址就是 http://ip/admin</h3>
<h3>默认用户名administrator和密码radius登录</h3>
<p><em>重启mysql和apache服务</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">service httpd restart
service mysqld restart</pre></td></tr></table></div>

<blockquote><p>
daloRADIUS似乎写的不怎么样，最新稳定版已经是三年之前的了，不过作者直到现在还在更新SVN，下次有机会可以用最新的SVN版本试试看。在Management中添加一个新用户，<em>注意密码类型选择Cleartext-Password。</em></p>
<p>在终端里再次启动radius -X，同时在另一个终端中用radtest username password localhost 0 MyVPN测试一下，看看现在是不是还能正常接通，如果没问题就OK，让我们把这套系统接驳到PPP上。
</p></blockquote>
<h5>配置Pppd</h5>
<p><em>编辑/etc/ppp/options.pptpd，里面已经有许多配置选项了，我们要保证有下面的几行，如果没有就添加上去，为了保障用户登录的安全我们限制只使用MS-CHAPv2：</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="pptp" style="font-family:monospace;">refuse-pap
refuse-chap
refuse-mschap
require-mppe-128
require-mschap-v2</pre></td></tr></table></div>

<h3>在配置文件最后加上3行：</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="pptp" style="font-family:monospace;">plugin radius.so
plugin radattr.so
radius-config-file /usr/local/etc/radiusclient/radiusclient.conf</pre></td></tr></table></div>

<h5>流量控制服务</h5>
<p><em>建立表格</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> radgroupreply <span style="color: #FF00FF;">&#40;</span>groupname<span style="color: #000033;">,</span>attribute<span style="color: #000033;">,</span>op<span style="color: #000033;">,</span><span style="color: #990099; font-weight: bold;">VALUE</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'user'</span><span style="color: #000033;">,</span><span style="color: #008000;">'Auth-Type'</span><span style="color: #000033;">,</span><span style="color: #008000;">':='</span><span style="color: #000033;">,</span><span style="color: #008000;">'Local'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> radgroupreply <span style="color: #FF00FF;">&#40;</span>groupname<span style="color: #000033;">,</span>attribute<span style="color: #000033;">,</span>op<span style="color: #000033;">,</span><span style="color: #990099; font-weight: bold;">VALUE</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'user'</span><span style="color: #000033;">,</span><span style="color: #008000;">'Service-Type'</span><span style="color: #000033;">,</span><span style="color: #008000;">':='</span><span style="color: #000033;">,</span><span style="color: #008000;">'Framed-User'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> radgroupreply <span style="color: #FF00FF;">&#40;</span>groupname<span style="color: #000033;">,</span>attribute<span style="color: #000033;">,</span>op<span style="color: #000033;">,</span><span style="color: #990099; font-weight: bold;">VALUE</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'user'</span><span style="color: #000033;">,</span><span style="color: #008000;">'Framed-IP-Address'</span><span style="color: #000033;">,</span><span style="color: #008000;">':='</span><span style="color: #000033;">,</span><span style="color: #008000;">'255.255.255.255'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> radgroupreply <span style="color: #FF00FF;">&#40;</span>groupname<span style="color: #000033;">,</span>attribute<span style="color: #000033;">,</span>op<span style="color: #000033;">,</span><span style="color: #990099; font-weight: bold;">VALUE</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'user'</span><span style="color: #000033;">,</span><span style="color: #008000;">'Framed-IP-Netmask'</span><span style="color: #000033;">,</span><span style="color: #008000;">':='</span><span style="color: #000033;">,</span><span style="color: #008000;">'255.255.255.0'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> radgroupreply <span style="color: #FF00FF;">&#40;</span>groupname<span style="color: #000033;">,</span>attribute<span style="color: #000033;">,</span>op<span style="color: #000033;">,</span><span style="color: #990099; font-weight: bold;">VALUE</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'user'</span><span style="color: #000033;">,</span><span style="color: #008000;">'Acct-Interim-Interval'</span><span style="color: #000033;">,</span><span style="color: #008000;">':='</span><span style="color: #000033;">,</span><span style="color: #008000;">'600'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> radgroupreply <span style="color: #FF00FF;">&#40;</span>groupname<span style="color: #000033;">,</span>attribute<span style="color: #000033;">,</span>op<span style="color: #000033;">,</span><span style="color: #990099; font-weight: bold;">VALUE</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'user'</span><span style="color: #000033;">,</span><span style="color: #008000;">'Max-Monthly-Traffic'</span><span style="color: #000033;">,</span><span style="color: #008000;">':='</span><span style="color: #000033;">,</span><span style="color: #008000;">'5368709120'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> radgroupcheck <span style="color: #FF00FF;">&#40;</span>groupname<span style="color: #000033;">,</span>attribute<span style="color: #000033;">,</span>op<span style="color: #000033;">,</span><span style="color: #990099; font-weight: bold;">VALUE</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'user'</span><span style="color: #000033;">,</span><span style="color: #008000;">'Simultaneous-Use'</span><span style="color: #000033;">,</span><span style="color: #008000;">':='</span><span style="color: #000033;">,</span><span style="color: #008000;">'1'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p><em>以上前四行不用改动，acct-interim-interval是计算流量的间隔（600秒），意味着每隔10分钟记录当前流量。倒数第二行是每月最大流量，这里是5G（单位是字节）。最后一行是允许同时连接数目。</em></p>
<h3>访问daloRADIUS，在Management中添加一个新用户，注意密码类型选择Cleartext-Password。用户组选择user</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">radius <span style="color: #660033;">-X</span>
radtest username password localhost <span style="color: #000000;">0</span> LaoxieVPN</pre></td></tr></table></div>

<h3>测试一下，看看现在是不是还能正常接通，如果没问题就OK</h3>
<p><em>如果结果中有Access-Accept就代表成功了，否则退回去检查设置。</em></p>
<p><em>测试成功的话添加在认证时检测流量的语句，打开/usr/local/etc/raddb/sites-enabled/default，找到authorize一节插入：</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">update</span> request <span style="color: #FF00FF;">&#123;</span>
Group<span style="color: #CC0099;">-</span>Name <span style="color: #CC0099;">:=</span> <span style="color: #008000;">&quot;<span style="color: #008080; font-weight: bold;">%</span>{sql:SELECT groupname FROM radusergroup WHERE username='<span style="color: #008080; font-weight: bold;">%</span>{User-Name}' ORDER BY priority}&quot;</span>
<span style="color: #FF00FF;">&#125;</span>
<span style="color: #009900;">if</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;<span style="color: #008080; font-weight: bold;">%</span>{sql: SELECT SUM(acctinputoctets+acctoutputoctets) FROM radacct WHERE username='<span style="color: #008080; font-weight: bold;">%</span>{User-Name}' AND date<span style="color: #008080; font-weight: bold;">_</span>format(acctstarttime, '<span style="color: #008080; font-weight: bold;">%</span>Y-<span style="color: #008080; font-weight: bold;">%</span>m-<span style="color: #008080; font-weight: bold;">%</span>d') &gt;= date<span style="color: #008080; font-weight: bold;">_</span>format(now(),'<span style="color: #008080; font-weight: bold;">%</span>Y-<span style="color: #008080; font-weight: bold;">%</span>m-01') AND date<span style="color: #008080; font-weight: bold;">_</span>format(acctstoptime, '<span style="color: #008080; font-weight: bold;">%</span>Y-<span style="color: #008080; font-weight: bold;">%</span>m-<span style="color: #008080; font-weight: bold;">%</span>d') &lt;= last<span style="color: #008080; font-weight: bold;">_</span>day(now());}&quot;</span> <span style="color: #CC0099;">&gt;=</span> <span style="color: #008000;">&quot;<span style="color: #008080; font-weight: bold;">%</span>{sql: SELECT value FROM radgroupreply WHERE groupname='<span style="color: #008080; font-weight: bold;">%</span>{Group-Name}' AND&amp;nbsp;attribute='Max-Monthly-Traffic';}&quot;</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #FF00FF;">&#123;</span>
reject
<span style="color: #FF00FF;">&#125;</span></pre></td></tr></table></div>

<h5>启动服务</h5>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">service radiusd start
chkconfig radiusd on
chkconfig pptpd on</pre></td></tr></table></div>

<p><a href="http://laoxie-upload.stor.sinaapp.com/daloradius.png"><img src="http://laoxie-upload.stor.sinaapp.com/daloradius.png" alt="CentOS PPTP配置FreeRADIUS+DaloRADIUS实现高级用户控制+流量控制" title="DaloRADIUS" width="900" hight="520"/></a></p>
<p><em>至此，已经完成所有操作了！</em></p>
<h3>本文主要参考以下文章，感谢以下所有文字创建者</h3>
<blockquote><p>
<a href="http://dayanjia.com/2011/03/configure-freeradius-and-daloradius-on-pptp-vpn-server.html">在PPTP VPN服务器上配置FreeRADIUS+DaloRADIUS实现用户跟踪管理</a><br />
<a href="http://tomem.info/blog/2011/04/562">PPTP+FreeRADIUS+MySQL搭建VPN认证和流量控制</a><br />
<a href="http://www.lazylei.com/index.php/2010/11/ara-asn-radius-admin-freeradius-%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%AE%89%E8%A3%85%E6%80%BB%E7%BB%93/">ARA (ASN RADIUS admin) – FreeRADIUS 管理程序安装总结</a>
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2323.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>OpenVZ VPS配置PPTP VPN</title>
		<link>http://www.xj123.info/2301.html</link>
		<comments>http://www.xj123.info/2301.html#comments</comments>
		<pubDate>Sun, 22 Jan 2012 16:00:38 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[OPENVZVPN]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[VPN配置教程]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2301</guid>
		<description><![CDATA[VPS环境：intovps 512M 软件环境：CentOS 5.X 32bit 操作前的准备操作 1 2 3 4 5 yum remove -y pptpd ppp iptables --flush POSTROUTING --table nat iptables --flush FORWARD rm -rf /etc/pptpd.conf rm -rf /etc/ppp 一、检测VPS是否支持TUN和PPP 1 cat /dev/net/tun 返回：cat: /dev/net/tun: File descriptor in bad state，表示通过 1 cat /dev/ppp cat: /dev/ppp: No such device or address，表示通过 返回：“Permission denied”则不通过。可以尝试联系vps客服，是否可以开通TUN和PPP功能 二、安装ppp、iptables、pptp 1 [...]]]></description>
			<content:encoded><![CDATA[<h3>VPS环境：intovps 512M</h3>
<h3>软件环境：CentOS 5.X 32bit</h3>
<p><em>操作前的准备操作</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">yum remove <span style="color: #660033;">-y</span> pptpd ppp
iptables <span style="color: #660033;">--flush</span> POSTROUTING <span style="color: #660033;">--table</span> nat
iptables <span style="color: #660033;">--flush</span> FORWARD
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pptpd.conf
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ppp</pre></td></tr></table></div>

<p><span id="more-2301"></span><br />
<em>一、检测VPS是否支持TUN和PPP</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun</pre></td></tr></table></div>

<blockquote><p>返回：cat: /dev/net/tun: File descriptor in bad state，表示通过</p></blockquote>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ppp</pre></td></tr></table></div>

<blockquote><p>cat: /dev/ppp: No such device or address，表示通过</p></blockquote>
<p><em>返回：“Permission denied”则不通过。</em>可以尝试联系vps客服，是否可以开通TUN和PPP功能</p>
<p><em>二、安装ppp、iptables、pptp</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">-y</span> ppp iptables
rpm <span style="color: #660033;">-ivh</span> http:<span style="color: #000000; font-weight: bold;">//</span>vps.xj123.info<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>ppp<span style="color: #000000; font-weight: bold;">/</span>pptpd-1.3.4-<span style="color: #000000;">1</span>.rhel5.1.i386.rpm
<span style="color: #c20cb9; font-weight: bold;">mknod</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ppp c <span style="color: #000000;">108</span> <span style="color: #000000;">0</span> 
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;mknod /dev/ppp c 108 0&quot;</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</pre></td></tr></table></div>

<p><em>64bit则执行：rpm -ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.x86_64.rpm</em></p>
<p><em>三、编辑配置文件</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;localip 172.16.36.1&quot;</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>pptpd.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;remoteip 172.16.36.2-254&quot;</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>pptpd.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ms-dns 8.8.8.8&quot;</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>ppp<span style="color: #000000; font-weight: bold;">/</span>options.pptpd
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ms-dns 8.8.4.4&quot;</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>ppp<span style="color: #000000; font-weight: bold;">/</span>options.pptpd</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysctl.conf</pre></td></tr></table></div>

<h3>找到net.ipv4.ip_forward，把值编辑为1</h3>
<h3>找到net.ipv4.tcp_syncookies，前面加上注释符 #</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">sysctl <span style="color: #660033;">-p</span></pre></td></tr></table></div>

<p><em>iptables规则</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-A</span> POSTROUTING <span style="color: #660033;">-s</span> 172.16.36.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> <span style="color: #660033;">-j</span> SNAT <span style="color: #660033;">--to-source</span> vps公网ip
iptables <span style="color: #660033;">-A</span> FORWARD <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--syn</span> <span style="color: #660033;">-s</span> 172.16.36.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> <span style="color: #660033;">-j</span> TCPMSS <span style="color: #660033;">--set-mss</span> <span style="color: #000000;">1356</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><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>iptables save
<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>iptables restart
<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>pptpd restart</pre></td></tr></table></div>

<p><em>编辑用户</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ppp<span style="color: #000000; font-weight: bold;">/</span>chap-secrets</pre></td></tr></table></div>

<h3>用户、密码例：laoxie pptpd laoxie *</h3>
<p><em>开机运行</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">chkconfig pptpd on
chkconfig iptables on</pre></td></tr></table></div>

<blockquote><p>
本文主要参考以下文章：<br />
http://www.piaoyi.org/network/OpenVZ-VPS-PPTP-VPN.html OpenVZ VPS搭建PPTP VPN的方法<br />
http://www.laohao.info/openvz-vps-concise-guide-to-install-the-pptp-vpn-service/ OpenVZ vps安装PPTP VPN服务简明教程<br />
http://wiki.wowubuntu.com/linux/openvz-archlinux-pptp-vpn OpenVZ VPS 上架设 PPTP VPN ( BuyVM &#038; ArchLinux)<br />
主要参考diahosting的一键pptp安装脚本
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2301.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>网站压力测试工具webbench</title>
		<link>http://www.xj123.info/2297.html</link>
		<comments>http://www.xj123.info/2297.html#comments</comments>
		<pubDate>Sat, 21 Jan 2012 16:00:30 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[webbench压力测试]]></category>
		<category><![CDATA[网站压力测试]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2297</guid>
		<description><![CDATA[webbench最多可以模拟3万个并发连接去测试网站的负载能力,对于老谢博客,日ip都没有过百,压力测试其实意义不大，嘿嘿 编译安装 1 2 3 4 5 wget http://vps.xj123.info/usr/local/webbench-1.5.tar.gz tar zxvf webbench-1.5.tar.gz cd webbench-1.5 mkdir /usr/local/man make &#38;&#38; make install 使用方法：webbench -c 500 -t 30 http://vps.xj123.info/info.php 参数说明：-c表示并发数，-t表示时间(秒) 附一张老谢博客的测试，老谢的技术很弱，搭的服务器性能很差 [root@vps ~]# webbench -c 10 -t 30 http://www.xj123.info/index.php Webbench &#8211; Simple Web Benchmark 1.5 Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software. Benchmarking: GET http://www.xj123.info/index.php 10 [...]]]></description>
			<content:encoded><![CDATA[<p><em>webbench最多可以模拟3万个并发连接去测试网站的负载能力,对于老谢博客,日ip都没有过百,压力测试其实意义不大，嘿嘿</em></p>
<p><em>编译安装</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>vps.xj123.info<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webbench-<span style="color: #000000;">1.5</span>.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf webbench-<span style="color: #000000;">1.5</span>.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> webbench-<span style="color: #000000;">1.5</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">man</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<h3>使用方法：webbench -c 500 -t 30 http://vps.xj123.info/info.php</h3>
<h3>参数说明：-c表示并发数，-t表示时间(秒)</h3>
<p>附一张老谢博客的测试，老谢的技术很弱，搭的服务器性能很差</p>
<blockquote><p>
[root@vps ~]# webbench -c 10 -t 30 http://www.xj123.info/index.php<br />
Webbench &#8211; Simple Web Benchmark 1.5<br />
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.</p>
<p>Benchmarking: GET http://www.xj123.info/index.php<br />
10 clients, running 30 sec.</p>
<p>Speed=174 pages/min, 148795 bytes/sec.<br />
Requests: 87 susceed, 0 failed.
</p></blockquote>
<p><em>为了更准确的结果，建议在另外一台vps安装webbench，因为该工具本身会占用一些资源</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2297.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>安装及配置eaccelerator-0.9.6.1加速PHP5.3.8</title>
		<link>http://www.xj123.info/2281.html</link>
		<comments>http://www.xj123.info/2281.html#comments</comments>
		<pubDate>Fri, 20 Jan 2012 16:00:54 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[eaccelerator加速PHP]]></category>
		<category><![CDATA[eaccelerator编译安装]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2281</guid>
		<description><![CDATA[获取安装eaccelerator-0.9.6.1 1 2 3 http://vps.xj123.info/usr/lamp/eaccelerator-0.9.6.1.zip unzip eaccelerator-0.9.6.1.zip cd eaccelerator-0.9.6.1 指定php所在路径 1 2 3 4 export PHP_PREFIX=&#34;/usr/local/php&#34; $PHP_PREFIX/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config make &#38;&#38; make install 这时会将eaccelerator安装到php目录中，屏幕会显示eaccelerator.so所在路径，例如： Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20060613/ 记住这个路径!! eaccelerator即可以安装为PHP扩展，也可以安装为zend扩展，以下安装为PHP扩展。 　　 如果存在/etc/php.d目录，需要拷贝eaccelerator.ini到该目录下，然后修改缺省值。如果不存在，修改php.ini，在[zend]之前加入以下内容(注：必须放在[zend]之前)： 1 vi /usr/local/php/etc/php.ini 添加以下内容 [eaccelerator] extension=”/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so” eaccelerator.shm_size=”32&#8243; eaccelerator.cache_dir=”/usr/cache/eaccelerator” eaccelerator.enable=”1&#8243; eaccelerator.optimizer=”1&#8243; eaccelerator.check_mtime=”1&#8243; eaccelerator.debug=”0&#8243; eaccelerator.filter=”" eaccelerator.shm_max=”0&#8243; eaccelerator.shm_ttl=”0&#8243; eaccelerator.shm_prune_period=”0&#8243; eaccelerator.shm_only=”0&#8243; eaccelerator.compress=”1&#8243; eaccelerator.compress_level=”9&#8243; 建立缓存目录 1 2 [...]]]></description>
			<content:encoded><![CDATA[<p><em>获取安装eaccelerator-0.9.6.1</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">http:<span style="color: #000000; font-weight: bold;">//</span>vps.xj123.info<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lamp<span style="color: #000000; font-weight: bold;">/</span>eaccelerator-0.9.6.1.zip
<span style="color: #c20cb9; font-weight: bold;">unzip</span> eaccelerator-0.9.6.1.zip
<span style="color: #7a0874; font-weight: bold;">cd</span> eaccelerator-0.9.6.1</pre></td></tr></table></div>

<p><em>指定php所在路径</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PHP_PREFIX</span>=<span style="color: #ff0000;">&quot;/usr/local/php&quot;</span>
<span style="color: #007800;">$PHP_PREFIX</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>phpize
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-eaccelerator</span>=shared <span style="color: #660033;">--with-php-config</span>=<span style="color: #007800;">$PHP_PREFIX</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php-config
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p><em>这时会将eaccelerator安装到php目录中，屏幕会显示eaccelerator.so所在路径，例如：</em></p>
<h3>Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20060613/</h3>
<p><em><strong><span style="color:#A70;">记住这个路径!!</span></strong></em></p>
<p><span id="more-2281"></span></p>
<blockquote><p>
eaccelerator即可以安装为PHP扩展，也可以安装为zend扩展，以下安装为PHP扩展。<br />
　　<br />
如果存在/etc/php.d目录，需要拷贝eaccelerator.ini到该目录下，然后修改缺省值。如果不存在，修改php.ini，在[zend]之前加入以下内容(注：必须放在[zend]之前)：
</p></blockquote>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini</pre></td></tr></table></div>

<h3>添加以下内容</h3>
<blockquote><p>
[eaccelerator]<br />
extension=”/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so”<br />
eaccelerator.shm_size=”32&#8243;<br />
eaccelerator.cache_dir=”/usr/cache/eaccelerator”<br />
eaccelerator.enable=”1&#8243;<br />
eaccelerator.optimizer=”1&#8243;<br />
eaccelerator.check_mtime=”1&#8243;<br />
eaccelerator.debug=”0&#8243;<br />
eaccelerator.filter=”"<br />
eaccelerator.shm_max=”0&#8243;<br />
eaccelerator.shm_ttl=”0&#8243;<br />
eaccelerator.shm_prune_period=”0&#8243;<br />
eaccelerator.shm_only=”0&#8243;<br />
eaccelerator.compress=”1&#8243;<br />
eaccelerator.compress_level=”9&#8243;
</p></blockquote>
<p><em>建立缓存目录</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>eaccelerator
<span style="color: #c20cb9; font-weight: bold;">chmod</span> 0777 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>eaccelerator
<span style="color: #666666; font-style: italic;">#重启apache</span>
service httpd restart</pre></td></tr></table></div>

<blockquote><p>
检查ZendOptimizer和eaccelerator是否安装成功</p>
<p>创建一个phpinfo.php文件，内容如下：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #990000;">phpinfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>将该文件放置到网站目录，在浏览器中访问，如果出现以下内容则安装成功：<br />
This program makes use of the Zend Scripting Language Engine:<br />
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies<br />
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator</p>
<p><em>本文主要参考：http://blog.s135.com/post/202/</em>
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2281.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>虚拟主机搬家到VPS（附操作步骤）</title>
		<link>http://www.xj123.info/2267.html</link>
		<comments>http://www.xj123.info/2267.html#comments</comments>
		<pubDate>Thu, 19 Jan 2012 04:20:07 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2267</guid>
		<description><![CDATA[嘿嘿,经过激烈的思想斗争,老谢决定搬到VPS了!!之前一直不敢用VPS，是技术实在不靠谱，怕买了以后一堆问题解决不掉，但玩了几个月buyvm的15刀，老谢越来越喜欢linux这个系统，对vps的渴望越来越强烈，于是乎，购买了V大的OKVPS!!!性能非常棒!!并且速度也很快，线路是冷门线路，比较适合老谢这样的小博客老老实实长期呆在里面，如果大家需要购买vps，强烈推荐okvps，传送门在此!! -> okvps传送门 老谢购买的vps配置如下 可用内存：512M 高速硬盘：20G IPV4：1个 端口：10Mb/S 流量：500G/月 这样的配置对于老谢博客这样的小网站，绰绰有余了！并且价格非常低，只要￥60/月 心动不如行动，欲购从速!!okvps，真的ok!!! 导出网站数据 老谢的虚拟主机采用Cpanel面板，拥有SSH权限，以下为操作步骤 1 2 3 cd public_html mysqldump -u 用户名 -p 数据库名 &#62; wp.sql tar -czf backup.tar.gz * .&#91;!.&#93;* 导入网站数据 1 2 3 4 cd /usr/local/apache/htdocs/laoxie/ wget http://url/backup.tar.gz tar -xzf backup.tar.gz mysql -u 用户名 -p 数据库名 &#60; wp.sql 最后根据自己的实际情况，修改wp-config.php配置文件即可，如果你没有配置FTP，也没关系，用WinSCP一样可以做到操作文件 附：数据库创建+验证 登录MYSQL数据库 1 mysql -u [...]]]></description>
			<content:encoded><![CDATA[<p>嘿嘿,经过激烈的思想斗争,老谢决定搬到VPS了!!之前一直不敢用VPS，是技术实在不靠谱，怕买了以后一堆问题解决不掉，但玩了几个月buyvm的15刀，老谢越来越喜欢linux这个系统，对vps的渴望越来越强烈，于是乎，购买了<em><a href="http://vaman.org/" title="V大" target="_blank">V大</a></em>的<em><a href="http://www.okvps.com/" title="okvps" target="_blank">OKVPS</a></em>!!!性能非常棒!!并且速度也很快，线路是冷门线路，比较适合老谢这样的小博客老老实实长期呆在里面，如果大家需要购买vps，强烈推荐<em>okvps</em>，传送门在此!! -> <em><a href="http://www.okvps.com/" title="okvps" target="_blank">okvps传送门</a></em></p>
<p><em>老谢购买的vps配置如下</em></p>
<h3>可用内存：512M</h3>
<h3>高速硬盘：20G</h3>
<h3>IPV4：1个</h3>
<h3>端口：10Mb/S</h3>
<h3>流量：500G/月</h3>
<blockquote>
<h3>这样的配置对于老谢博客这样的小网站，绰绰有余了！并且价格非常低，<em>只要￥60/月</em><br />
<h3>
<p><em>心动不如行动，欲购从速!!okvps，真的ok!!!</em>
</p></blockquote>
<p><span id="more-2267"></span><br />
<em>导出网站数据</em></p>
<h3>老谢的虚拟主机采用Cpanel面板，拥有SSH权限，以下为操作步骤</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> public_html
mysqldump <span style="color: #660033;">-u</span> 用户名 <span style="color: #660033;">-p</span> 数据库名 <span style="color: #000000; font-weight: bold;">&gt;</span> wp.sql
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-czf</span> backup.tar.gz <span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">!</span>.<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">*</span></pre></td></tr></table></div>

<h3>导入网站数据</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>laoxie<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>url<span style="color: #000000; font-weight: bold;">/</span>backup.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> backup.tar.gz
mysql <span style="color: #660033;">-u</span> 用户名 <span style="color: #660033;">-p</span> 数据库名 <span style="color: #000000; font-weight: bold;">&lt;</span> wp.sql</pre></td></tr></table></div>

<p><em>最后根据自己的实际情况，修改wp-config.php配置文件即可，如果你没有配置FTP，也没关系，用WinSCP一样可以做到操作文件</em></p>
<p><em>附：数据库创建+验证</em></p>
<blockquote>
<h3>登录MYSQL数据库</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span></pre></td></tr></table></div>

<h3>创建一个名为wp的MYSQL数据库</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> wp<span style="color: #000033;">;</span></pre></td></tr></table></div>

<h3>选择将要操作的数据库</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">USE</span> wp</pre></td></tr></table></div>

<h3>查看数据库中的表，验证是否导入成功</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SHOW</span> <span style="color: #990099; font-weight: bold;">TABLES</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

</blockquote>
<p><em>至此,搬家全部结束</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2267.html/feed</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Centos5.X Apache添加虚拟主机</title>
		<link>http://www.xj123.info/2264.html</link>
		<comments>http://www.xj123.info/2264.html#comments</comments>
		<pubDate>Thu, 19 Jan 2012 02:00:19 +0000</pubDate>
		<dc:creator>老谢</dc:creator>
				<category><![CDATA[服务器技术]]></category>
		<category><![CDATA[Apache添加虚拟主机]]></category>

		<guid isPermaLink="false">http://www.xj123.info/?p=2264</guid>
		<description><![CDATA[添加虚拟主机，不仅安全，而且管理起来更方便，虽然老谢的vps只有一个老谢博客站点，但是说不准以后哪天就会添加一个网站，到时候再改就稍显麻烦，让我们一开始就养成好习惯，跟老谢一起创建虚拟主机吧！ 编辑apache的配置文件，启用虚拟主机 1 vi /usr/local/apache/conf/httpd.conf 找到 Include conf/extra/httpd-vhosts.conf 把开头的#注释符号去掉，这样就打开了虚拟主机功能，保存退出 添加虚拟主机 1 vim /usr/local/apache/conf/extra/httpd-vhosts.conf 里面有两个example，大家其实根据example就可以添加自己的虚拟主机，但是老谢这里为了增加文章篇幅，还是说明一下吧~~ 以下是默认的虚拟主机例子 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 &#60;VirtualHost *:80&#62; ServerAdmin webmaster@dummy-host.example.com DocumentRoot &#34;/usr/local/apache/docs/dummy-host.example.com&#34; ServerName dummy-host.example.com ServerAlias www.dummy-host.example.com ErrorLog &#34;logs/dummy-host.example.com-error_log&#34; CustomLog &#34;logs/dummy-host.example.com-access_log&#34; common &#60;/VirtualHost&#62; &#160; &#60;VirtualHost *:80&#62; ServerAdmin webmaster@dummy-host2.example.com DocumentRoot &#34;/usr/local/apache/docs/dummy-host2.example.com&#34; ServerName [...]]]></description>
			<content:encoded><![CDATA[<p>添加虚拟主机，不仅安全，而且管理起来更方便，虽然老谢的vps只有一个<em>老谢博客</em>站点，但是说不准以后哪天就会添加一个网站，到时候再改就稍显麻烦，让我们一开始就养成好习惯，跟老谢一起创建虚拟主机吧！</p>
<p><em>编辑apache的配置文件，启用虚拟主机</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>httpd.conf</pre></td></tr></table></div>

<p>找到<br />
<h3>Include conf/extra/httpd-vhosts.conf</h3>
<p>把开头的<em>#</em>注释符号去掉，这样就打开了虚拟主机功能，保存退出</p>
<p><span id="more-2264"></span><br />
<em>添加虚拟主机</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>extra<span style="color: #000000; font-weight: bold;">/</span>httpd-vhosts.conf</pre></td></tr></table></div>

<p>里面有两个example，大家其实根据example就可以添加自己的虚拟主机，但是老谢这里为了增加文章篇幅，还是说明一下吧~~</p>
<p><em>以下是默认的虚拟主机例子</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span>
    ServerAdmin webmaster<span style="color: #000000; font-weight: bold;">@</span>dummy-host.example.com
    DocumentRoot <span style="color: #ff0000;">&quot;/usr/local/apache/docs/dummy-host.example.com&quot;</span>
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog <span style="color: #ff0000;">&quot;logs/dummy-host.example.com-error_log&quot;</span>
    CustomLog <span style="color: #ff0000;">&quot;logs/dummy-host.example.com-access_log&quot;</span> common
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span>
    ServerAdmin webmaster<span style="color: #000000; font-weight: bold;">@</span>dummy-host2.example.com
    DocumentRoot <span style="color: #ff0000;">&quot;/usr/local/apache/docs/dummy-host2.example.com&quot;</span>
    ServerName dummy-host2.example.com
    ErrorLog <span style="color: #ff0000;">&quot;logs/dummy-host2.example.com-error_log&quot;</span>
    CustomLog <span style="color: #ff0000;">&quot;logs/dummy-host2.example.com-access_log&quot;</span> common
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p><em>创建属于自己的虚拟主机，以xj123.info举例</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span>
    ServerAdmin webmaster<span style="color: #000000; font-weight: bold;">@</span>xj123.info
    DocumentRoot <span style="color: #ff0000;">&quot;/usr/local/apache/htdocs/laoxie&quot;</span>
    ServerName xj123.info
    ServerAlias www.xj123.info
    ErrorLog <span style="color: #ff0000;">&quot;logs/xj123.info-error_log&quot;</span>
    CustomLog <span style="color: #ff0000;">&quot;logs/xj123.info-access_log&quot;</span> common
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<h3>把编辑好的虚拟主机配置，保存到httpd-vhosts.conf即可，<em>别忘记删除两个example</em></h3>
<p><em>DocumentRoot就是根目录的路径</em></p>
<p><em>创建目录，更改所属用户，用户组</em></p>
<h3>由于老谢目前在/usr/local/apache/htdocs/没有laoxie这个目录，那么执行下面命令操作</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>laoxie
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www:www <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.xj123.info/2264.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

