<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://wiki.wowubuntu.com/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel>
        <title>Wow! Ubuntu</title>
        <description></description>
        <link>http://wiki.wowubuntu.com/</link>
        <lastBuildDate>Thu, 17 May 2012 07:33:16 -0400</lastBuildDate>
        <generator>FeedCreator 1.7.2-ppt DokuWiki</generator>
        <image>
            <url>http://wiki.wowubuntu.com/ttp://wiki.wowubuntu.com/lib/tpl/vector/images/favicon.ico</url>
            <title>Wow! Ubuntu</title>
            <link>http://wiki.wowubuntu.com/</link>
        </image>
        <item>
            <title>在 Freebsd 上用 mpd5 构建 PPTP VPN</title>
            <link>http://wiki.wowubuntu.com/freebsd/mpd5_pptp</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot;&gt;&lt;a name=&quot;在_freebsd_上用_mpd5_构建_pptp_vpn&quot; id=&quot;在_freebsd_上用_mpd5_构建_pptp_vpn&quot;&gt;在 Freebsd 上用 mpd5 构建 PPTP VPN&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT1 SECTION &quot;在 Freebsd 上用 mpd5 构建 PPTP VPN&quot; [1-55] --&gt;
&lt;h2 class=&quot;sectionedit2&quot;&gt;&lt;a name=&quot;安装_mpd5&quot; id=&quot;安装_mpd5&quot;&gt;安装 MPD5&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;code&quot;&gt;cd /usr/ports/net/mpd5
make install clean&lt;/pre&gt;

&lt;p&gt;
在 /etc/rc.conf 中启用 mpd5 添加如下行
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;mpd_enable=&amp;quot;YES&amp;quot;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT2 SECTION &quot;安装 MPD5&quot; [56-218] --&gt;
&lt;h2 class=&quot;sectionedit3&quot;&gt;&lt;a name=&quot;配置_mpd_pptp_vpn&quot; id=&quot;配置_mpd_pptp_vpn&quot;&gt;配置 mpd pptp VPN&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
复制默认的 mpd.conf 配置文件
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;cd /usr/local/etc/mpd5/
cp mpd.conf.sample mpd.conf&lt;/pre&gt;

&lt;p&gt;
修改 mpd.conf 文件中的 startup:  default:  pptp_server: 三块，其它的不要理睬，放在里面不要删除，因为可以通过 default: 标签来调用需要执行的模块，所以不受影响。
&lt;/p&gt;

&lt;p&gt;
以下是这三部分的代码，需要修改的地方见我的中文解释。
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
startup:
        # configure mpd users
        set user admin password ### 设置 mpd 的访问帐号及密码，通过 telnet 或 web 访问时需要此帐号
        #set user foo1 bar1
        # configure the console
        set console self 127.0.0.1 5005
        set console open
        # configure the web server
        set web self 0.0.0.0 5006
        set web open

#
# Default configuration is &amp;quot;dialup&amp;quot;

default:
        #load dialup
        load pptp_server ### 默认调用 pptp_server 模块

pptp_server:
#
# Mpd as a PPTP server compatible with Microsoft Dial-Up Networking clients.
#
# Suppose you have a private Office LAN numbered 192.168.1.0/24 and the
# machine running mpd is at 192.168.1.1, and also has an externally visible
# IP address of 1.2.3.4.
#
# We want to allow a client to connect to 1.2.3.4 from out on the Internet
# via PPTP.  We will assign that client the address 192.168.1.50 and proxy-ARP
# for that address, so the virtual PPP link will be numbered 192.168.1.1 local
# and 192.168.1.50 remote.  From the client machine&amp;#039;s perspective, it will
# appear as if it is actually on the 192.168.1.0/24 network, even though in
# reality it is somewhere far away out on the Internet.
#
# Our DNS server is at 192.168.1.3 and our NBNS (WINS server) is at 192.168.1.4.
# If you don&amp;#039;t have an NBNS server, leave that line out.
#

# Define dynamic IP address pool.
        set ippool add pool1 192.168.1.50 192.168.1.99

# Create clonable bundle template named B
        create bundle template B
        set iface enable proxy-arp
        set iface idle 1800
        set iface enable tcpmssfix
        set ipcp yes vjcomp
# Specify IP address pool for dynamic assigment.
        set ipcp ranges 192.168.1.1/32 ippool pool1
        set ipcp dns 8.8.8.8  ### 设置 dns
        #set ipcp nbns 192.168.1.4 ###如果你用不到 wins 的话，可以注释掉这块，
# The five lines below enable Microsoft Point-to-Point encryption
# (MPPE) using the ng_mppc(8) netgraph node type.
        set bundle enable compression
        set ccp yes mppc
        set mppc yes e40
        set mppc yes e128
        set mppc yes stateless
# Create clonable link template named L
        create link template L pptp
# Set bundle template to use
        set link action bundle B
# Multilink adds some overhead, but gives full 1500 MTU.
        set link enable multilink
        set link yes acfcomp protocomp
        set link no pap chap eap
        set link enable chap
        
# We can use use RADIUS authentication/accounting by including
# another config section with label &amp;#039;radius&amp;#039;.
#       load radius
        set link keep-alive 10 60
# We reducing link mtu to avoid GRE packet fragmentation.
        set link mtu 1460
# Configure PPTP
        set pptp self 202.101.8.18 ###设置 pptp 的监听 ip 地址，也就是你的网卡的 IP 地址
# Allow to accept calls
        set link enable incoming
&lt;/pre&gt;

&lt;p&gt;
好了，就这么简单。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT3 SECTION &quot;配置 mpd pptp VPN&quot; [219-3616] --&gt;
&lt;h2 class=&quot;sectionedit4&quot;&gt;&lt;a name=&quot;启动_mpd5&quot; id=&quot;启动_mpd5&quot;&gt;启动 mpd5&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;code&quot;&gt; /usr/local/etc/rc.d/mpd5 start&lt;/pre&gt;

&lt;p&gt;
检查 mpd5 是否已经启动
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;netstat -a&lt;/pre&gt;

&lt;p&gt;
可以看到类似于这样的输出信息
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;tcp4       0      0 vpn.server..pptp  *.*                    LISTEN&lt;/pre&gt;

&lt;p&gt;
说明 pptp 已正常启动
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT4 SECTION &quot;启动 mpd5&quot; [3617-3904] --&gt;
&lt;h2 class=&quot;sectionedit5&quot;&gt;&lt;a name=&quot;添加_vpn_帐号&quot; id=&quot;添加_vpn_帐号&quot;&gt;添加 VPN 帐号&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
创建 /usr/local/etc/mpd5/mpd.secret 文件，输入用户名及密码，一行一个
&lt;/p&gt;

&lt;p&gt;
如
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;vpnaccount1  password1
vpnaccount2  password2
riku         password3&lt;/pre&gt;

&lt;p&gt;
然后就可以在 windows 下尝试登录 vpn 服务器了
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT5 SECTION &quot;添加 VPN 帐号&quot; [3905-4173] --&gt;
&lt;h2 class=&quot;sectionedit6&quot;&gt;&lt;a name=&quot;启用包转发&quot; id=&quot;启用包转发&quot;&gt;启用包转发&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
以上配置好后，但只能访问内部网络，而不访问外网，所以要让服务器启用包转发。我用 ipfw 来提供此功能。
&lt;/p&gt;

&lt;p&gt;
在 /etc/rc.conf 中加入以下行
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;gateway_enable=&amp;quot;YES&amp;quot;
firewall_enable=&amp;quot;YES&amp;quot;
firewall_type=&amp;quot;OPEN&amp;quot;
firewall_logging_enable=&amp;quot;YES&amp;quot;
natd_enable=&amp;quot;YES&amp;quot;
natd_interface=&amp;quot;em0&amp;quot; // em0 为网卡型号，你可以用 ifconfig 来检查你的网卡型号&lt;/pre&gt;

&lt;p&gt;
编辑 ifpw 的规则文件 /etc/ipfw.rules
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;ipfw add allow all from any to any
ipfw add divert natd ip from any to any via em0&lt;/pre&gt;

&lt;p&gt;
最后重新启动
&lt;/p&gt;

&lt;p&gt;
当然如果你不想重启的话，也可以通过以下命令来启用包转发。
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;sysctl net.inet.ip.forwarding=1
/etc/rc.d/ipfw start&lt;/pre&gt;

&lt;p&gt;
好了，配置完成。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT6 SECTION &quot;启用包转发&quot; [4174-4953] --&gt;
&lt;h2 class=&quot;sectionedit7&quot;&gt;&lt;a name=&quot;高级_使用主机系统帐号登录&quot; id=&quot;高级_使用主机系统帐号登录&quot;&gt;高级：使用主机系统帐号登录&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
在 mpd.conf 中的 # load radius 后添加两行 
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;        set auth disable internal  ### 禁止使用 mpd.secert 文件作为帐户认证
        set auth enable system-auth ### 添加系统认证方式&lt;/pre&gt;

&lt;p&gt;
修改 /etc/login.conf ，把帐号加密方式改为 nth
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;        :passwd_format=nth:\
        #:passwd_format=md5:\&lt;/pre&gt;

&lt;p&gt;
重建 login.conf 数据库
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;cap_mkdb /etc/login.conf&lt;/pre&gt;

&lt;p&gt;
最后添加新帐户
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;adduser&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT7 SECTION &quot;高级：使用主机系统帐号登录&quot; [4954-5479] --&gt;
&lt;h1 class=&quot;sectionedit8&quot;&gt;&lt;a name=&quot;用_mpd5_作为_pptp_client_连接_vpn&quot; id=&quot;用_mpd5_作为_pptp_client_连接_vpn&quot;&gt;用 mpd5 作为 pptp client 连接 VPN&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
这块也很简单，只要改一下默认配置中的几行，见下面代码中的中文注释。
&lt;/p&gt;

&lt;p&gt;
另外，上面的default: 标签中要加入 load pptp_client 这行，以便重启 mpd 时加载 pptp client 模块。
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;pptp_client:
#
# PPTP client: only outgoing calls, auto reconnect,
# ipcp-negotiated address, one-sided authentication,
# default route points on ISP&amp;#039;s end
#

        create bundle static B1
        set iface route default
        set ipcp ranges 0.0.0.0/0 0.0.0.0/0

        create link static L1 pptp
        set link action bundle B1
        set auth authname riku  ###VPN 帐号
        set auth password password  ###  VPN 密码
        set link max-redial 0
        set link mtu 1460
        set link keep-alive 20 75
        set pptp peer 208.1.2.3 ### VPN 服务器的 ip 地址
        set pptp disable windowing
        open&lt;/pre&gt;

&lt;p&gt;
重启 mpd5
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;/usr/local/etc/rc.d/mpd5 restart&lt;/pre&gt;

&lt;p&gt;
最后还需要重新设一下路由。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT8 SECTION &quot;用 mpd5 作为 pptp client 连接 VPN&quot; [5480-6511] --&gt;
&lt;h1 class=&quot;sectionedit9&quot;&gt;&lt;a name=&quot;参考&quot; id=&quot;参考&quot;&gt;参考&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
mpd5.5 手册 &lt;a href=&quot;http://mpd.sourceforge.net/doc5/mpd.html&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://mpd.sourceforge.net/doc5/mpd.html&quot;  rel=&quot;nofollow&quot;&gt;http://mpd.sourceforge.net/doc5/mpd.html&lt;/a&gt;
ipfw &lt;a href=&quot;http://www.freebsd.org/doc/zh_CN/books/handbook/firewalls-ipfw.html&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://www.freebsd.org/doc/zh_CN/books/handbook/firewalls-ipfw.html&quot;  rel=&quot;nofollow&quot;&gt;http://www.freebsd.org/doc/zh_CN/books/handbook/firewalls-ipfw.html&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT9 SECTION &quot;参考&quot; [6512-] --&gt;</description>
            <author>riku</author>
        <category>freebsd</category>
            <pubDate>Fri, 18 Feb 2011 02:26:36 -0400</pubDate>
        </item>
        <item>
            <title>MySQL 配置与优化</title>
            <link>http://wiki.wowubuntu.com/linux/mysql-kills</link>
            <description>
&lt;h1 class=&quot;sectionedit10&quot;&gt;&lt;a name=&quot;mysql_配置与优化&quot; id=&quot;mysql_配置与优化&quot;&gt;MySQL 配置与优化&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
默认没有配置文件，需要从 /usr/local/share/mysql/ 自已 Copy
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;cd /usr/local/share/mysql/
cp /usr/local/share/mysql/my-large.cnf /usr/local/etc/my.cnf
/usr/local/etc/rc.d/mysql-server restart&lt;/pre&gt;

&lt;p&gt;
参考：&lt;a href=&quot;http://www.barik.net/archive/2008/05/26/114616/&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://www.barik.net/archive/2008/05/26/114616/&quot;  rel=&quot;nofollow&quot;&gt;http://www.barik.net/archive/2008/05/26/114616/&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT10 SECTION &quot;MySQL 配置与优化&quot; [1-314] --&gt;
&lt;h2 class=&quot;sectionedit11&quot;&gt;&lt;a name=&quot;mysql_优化&quot; id=&quot;mysql_优化&quot;&gt;Mysql 优化&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
关掉InnoDB
&lt;/p&gt;

&lt;p&gt;
如果服务器用来放blog或是论坛，多数时候MyISAM就足够用了。此时可以把InnoDB关掉。
&lt;/p&gt;

&lt;p&gt;
my.cnf中的注释说：”You might want to disable InnoDB to shrink the mysqld process by circa 100MB.”。实测在VPS关掉Innodb时虽然没节约了100MB，但50M还是有的，内存珍贵，能省则省吧。
&lt;/p&gt;

&lt;p&gt;
只需在my.cnf加入一行 skip-innodb 就可以把InnoDB的功能关掉。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT11 SECTION &quot;Mysql 优化&quot; [315-762] --&gt;
&lt;h2 class=&quot;sectionedit12&quot;&gt;&lt;a name=&quot;新建_mysql_用户&quot; id=&quot;新建_mysql_用户&quot;&gt;新建 mysql 用户&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;code&quot;&gt;grant all privileges on dbname.* to user@localhost identified by &amp;#039;password&amp;#039;;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT12 SECTION &quot;新建 mysql 用户&quot; [763-887] --&gt;
&lt;h2 class=&quot;sectionedit13&quot;&gt;&lt;a name=&quot;导入导出数据&quot; id=&quot;导入导出数据&quot;&gt;导入导出数据&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
导出
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;mysqldump -uusername -ppassword dbname &amp;gt; dbname.sql&lt;/pre&gt;

&lt;p&gt;
导入 
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;mysql -u username -p dbname &amp;lt; dbname.sql&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT13 SECTION &quot;导入导出数据&quot; [888-1061] --&gt;
&lt;h2 class=&quot;sectionedit14&quot;&gt;&lt;a name=&quot;设置_root_密码&quot; id=&quot;设置_root_密码&quot;&gt;设置 root 密码&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;code&quot;&gt;mysqladmin -u root password ‘new_password’&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT14 SECTION &quot;设置 root 密码&quot; [1062-] --&gt;</description>
            <author>riku</author>
        <category>linux</category>
            <pubDate>Wed, 09 Feb 2011 22:02:21 -0400</pubDate>
        </item>
        <item>
            <title>让Freebsd 的 CSH 使用 Tab 自动提示补全命令</title>
            <link>http://wiki.wowubuntu.com/freebsd/csh_autolist</link>
            <description>
&lt;h1 class=&quot;sectionedit15&quot;&gt;&lt;a name=&quot;让freebsd_的_csh_使用_tab_自动提示补全命令&quot; id=&quot;让freebsd_的_csh_使用_tab_自动提示补全命令&quot;&gt;让Freebsd 的 CSH 使用 Tab 自动提示补全命令&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
用vi打开文件：/etc/csh.cshrc，在该文件中加入以下代码：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;set autolist&lt;/pre&gt;

&lt;/div&gt;
</description>
            <author>riku</author>
        <category>freebsd</category>
            <pubDate>Wed, 05 Jan 2011 01:41:12 -0400</pubDate>
        </item>
        <item>
            <title>几个在线测试工具</title>
            <link>http://wiki.wowubuntu.com/ubuntu/online-test</link>
            <description>
&lt;h1 class=&quot;sectionedit16&quot;&gt;&lt;a name=&quot;几个在线测试工具&quot; id=&quot;几个在线测试工具&quot;&gt;几个在线测试工具&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;http://loadimpact.com/&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://loadimpact.com/&quot;  rel=&quot;nofollow&quot;&gt;http://loadimpact.com/&lt;/a&gt; 网站页面载入速度测试
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.just-dnslookup.com/&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://www.just-dnslookup.com/&quot;  rel=&quot;nofollow&quot;&gt;http://www.just-dnslookup.com/&lt;/a&gt; 在线 &lt;acronym title=&quot;Domain Name System&quot;&gt;DNS&lt;/acronym&gt; 查询，可检查是否有 &lt;acronym title=&quot;Domain Name System&quot;&gt;DNS&lt;/acronym&gt; 污染的情况发生。
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://just-ping.com/&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://just-ping.com/&quot;  rel=&quot;nofollow&quot;&gt;http://just-ping.com/&lt;/a&gt; 在线分布式 Ping 工具，可检查某网站是否被墙。
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>riku</author>
        <category>ubuntu</category>
            <pubDate>Wed, 22 Dec 2010 03:46:37 -0400</pubDate>
        </item>
        <item>
            <title>Ubuntu VPS 配置与管理</title>
            <link>http://wiki.wowubuntu.com/ubuntu/vps-guide</link>
            <description>
&lt;h1 class=&quot;sectionedit17&quot;&gt;&lt;a name=&quot;ubuntu_vps_配置与管理&quot; id=&quot;ubuntu_vps_配置与管理&quot;&gt;Ubuntu VPS 配置与管理&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;http://wiki.wowubuntu.com/_detail/ubuntu/terminal_alt.png?id=ubuntu%3Avps-guide&quot; class=&quot;media&quot; title=&quot;ubuntu:terminal_alt.png&quot;&gt;&lt;img src=&quot;http://wiki.wowubuntu.com/_media/ubuntu/terminal_alt.png&quot; class=&quot;media&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Author : @riku /  Web :  &lt;a href=&quot;http://wowubuntu.com&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://wowubuntu.com&quot;  rel=&quot;nofollow&quot;&gt;Wow! Ubuntu&lt;/a&gt;
2010 年 12 月
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT17 SECTION &quot;Ubuntu VPS 配置与管理&quot; [1-151] --&gt;
&lt;h2 class=&quot;sectionedit18&quot;&gt;&lt;a name=&quot;前言&quot; id=&quot;前言&quot;&gt;前言&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
环境： Linode VPS ， 服务器及客户端系统都为 Ubuntu 10.10
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT18 SECTION &quot;前言&quot; [152-244] --&gt;
&lt;h2 class=&quot;sectionedit19&quot;&gt;&lt;a name=&quot;基础配置&quot; id=&quot;基础配置&quot;&gt;－）基础配置&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
为了服务器的安全性，新装好的 VPS 需要做一些简单的设置，禁止 root 帐号登录。
&lt;/p&gt;

&lt;p&gt;
添加新用户
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;adduser username&lt;/pre&gt;

&lt;p&gt;
把新用户加入 sudo 规则内
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;visudo&lt;/pre&gt;

&lt;p&gt;
添加
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;username ALL=(ALL) ALL&lt;/pre&gt;

&lt;p&gt;
以上的 username 用你新增的用户名替代。
&lt;/p&gt;

&lt;p&gt;
修改 sshd_config 文件，禁止 root 帐号登录
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;vi /etc/ssh/sshd_config&lt;/pre&gt;

&lt;p&gt;
把
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;PermitRootLogin yes&lt;/pre&gt;

&lt;p&gt;
改为
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;PermitRootLogin no&lt;/pre&gt;

&lt;p&gt;
重启 ssh 服务
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;/etc/init.d/ssh restart&lt;/pre&gt;

&lt;p&gt;
退出 VPS ，在本地生成 &lt;acronym title=&quot;Secure Shell&quot;&gt;SSH&lt;/acronym&gt; RSA key
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;ssh-keygen&lt;/pre&gt;

&lt;p&gt;
记得不要输入 passphrase ，然后把公钥上传到服务器
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;ssh-copy-id username@hostip&lt;/pre&gt;

&lt;p&gt;
这样你就可以不用密码直接登录了。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT19 SECTION &quot;－）基础配置&quot; [245-1054] --&gt;
&lt;h2 class=&quot;sectionedit20&quot;&gt;&lt;a name=&quot;二_构建_web_服务器_lnmp&quot; id=&quot;二_构建_web_服务器_lnmp&quot;&gt;二) 构建 Web 服务器(LNMP)&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
安装 Nginx, MySQL, &lt;acronym title=&quot;Hypertext Preprocessor&quot;&gt;PHP&lt;/acronym&gt;-Fpm
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;sudo apt-get install nginx php5 php5-dev php5-fpm php5-mysql mysql-server make&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;sudo update-rc.d nginx enable
sudo update-rc.d php5-fpm enable
sudo service nginx start 
sudo service php5-fpm start
sudo service mysql start&lt;/pre&gt;

&lt;p&gt;
&lt;strong&gt;优化&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
利用多核
&lt;/p&gt;

&lt;p&gt;
nginx 配置
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;worker_processes     4;
worker_cpu_affinity 0001 0010 0100 1000;&lt;/pre&gt;

&lt;p&gt;
&lt;strong&gt;缓存，再缓存&lt;/strong&gt;
安装 &lt;acronym title=&quot;Hypertext Preprocessor&quot;&gt;PHP&lt;/acronym&gt; 加速器 eaccelerator
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.zip
unzip eaccelerator-0.9.6.1.zip 
cd eaccelerator-0.9.6.1
phpize
./configure
make
sudo make install&lt;/pre&gt;

&lt;p&gt;
把以下行添加到 /etc/php5/fpm/php.ini 文件的最后
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
zend_extension=&amp;quot;/usr/lib/php5/20090626+lfs/eaccelerator.so&amp;quot;
eaccelerator.shm_size=&amp;quot;16&amp;quot;
eaccelerator.cache_dir=&amp;quot;/tmp/eaccelerator&amp;quot;
eaccelerator.enable=&amp;quot;1&amp;quot;
eaccelerator.optimizer=&amp;quot;1&amp;quot;
eaccelerator.check_mtime=&amp;quot;1&amp;quot;
eaccelerator.debug=&amp;quot;0&amp;quot;
eaccelerator.filter=&amp;quot;&amp;quot;
eaccelerator.shm_max=&amp;quot;0&amp;quot;
eaccelerator.shm_ttl=&amp;quot;0&amp;quot;
eaccelerator.shm_prune_period=&amp;quot;0&amp;quot;
eaccelerator.shm_only=&amp;quot;0&amp;quot;
eaccelerator.compress=&amp;quot;1&amp;quot;
eaccelerator.compress_level=&amp;quot;9&amp;quot;&lt;/pre&gt;

&lt;p&gt;
重启 php-fpm
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;sudo /etc/init.d/php5-fpm restart&lt;/pre&gt;

&lt;p&gt;
启用 Wordpress 缓存插件
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT20 SECTION &quot;二) 构建 Web 服务器(LNMP)&quot; [1055-2351] --&gt;
&lt;h2 class=&quot;sectionedit21&quot;&gt;&lt;a name=&quot;三_安装和配置_wordpress&quot; id=&quot;三_安装和配置_wordpress&quot;&gt;三) 安装和配置 Wordpress&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
安装 apache 压力测试工具 ab
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;sudo apt-get install apache2-utils&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT21 SECTION &quot;三) 安装和配置 Wordpress&quot; [2352-2481] --&gt;
&lt;h2 class=&quot;sectionedit22&quot;&gt;&lt;a name=&quot;四_性能测试_优化与监控&quot; id=&quot;四_性能测试_优化与监控&quot;&gt;四) 性能测试，优化与监控&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT22 SECTION &quot;四) 性能测试，优化与监控&quot; [2482-2531] --&gt;
&lt;h2 class=&quot;sectionedit23&quot;&gt;&lt;a name=&quot;五_日常维护与备份&quot; id=&quot;五_日常维护与备份&quot;&gt;五) 日常维护与备份&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT23 SECTION &quot;五) 日常维护与备份&quot; [2532-2572] --&gt;
&lt;h2 class=&quot;sectionedit24&quot;&gt;&lt;a name=&quot;六_安全&quot; id=&quot;六_安全&quot;&gt;六) 安全&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT24 SECTION &quot;六) 安全&quot; [2573-] --&gt;</description>
            <author>riku</author>
        <category>ubuntu</category>
            <pubDate>Tue, 21 Dec 2010 01:32:12 -0400</pubDate>
        </item>
    </channel>
</rss>

