之前一时兴起把博客由http改为http的协议,运行一段时间后发现问题多多,最直观的就是http的响应时间比http要多出800ms以上,这体验可以说简直了。
更不能忍的是,晚上访问博客,经常会卡死,这哪儿能行啊。
思来想去,我了个大去,这不能忍啊。还是果断改回来吧。
改回来理论上很简单,只需要把vhost里面的http部分删除,然后重启nginx即可。但是这样带来的问题是,之前搜索引擎收录的链接全变成死链了,这个也很要命啊,要想办法把链接无损重定向回来才好。
之前一时兴起把博客由http改为http的协议,运行一段时间后发现问题多多,最直观的就是http的响应时间比http要多出800ms以上,这体验可以说简直了。
更不能忍的是,晚上访问博客,经常会卡死,这哪儿能行啊。
思来想去,我了个大去,这不能忍啊。还是果断改回来吧。
改回来理论上很简单,只需要把vhost里面的http部分删除,然后重启nginx即可。但是这样带来的问题是,之前搜索引擎收录的链接全变成死链了,这个也很要命啊,要想办法把链接无损重定向回来才好。
昨天费了很大功夫,终于把博客从emlog迁移到wordpress。
过程中参照了这篇文章以及里面提供的工具,感谢。
http://www.1llo.cn/XinQi/325.html
简单说下迁移博客的过程,首先当然是数据备份,以防万一失败数据彻底丢失。然后把emlog网站content/uploadfile/以外的所有文件删除,并安装wordpress,运行转换工具开始转换即可。
过程中需要注意的是,如果文件转换失败,检查服务器的安全配置,php禁用函数里面关闭scandir函数禁用,就可以了。
主要是lnmp一键安装包里的 php.ini 禁止了 scandir 函数导致的。
工具在这里下载。
将博客搬到家里的电脑上运行了,但是如何将博客绑定之前的域名呢?经过一番研究,最终我使用frps成功实现了在家里电脑上跑博客。
首先你需要一个远程的服务器,在上面运行frps服务端,然后把你的顶级域名解析到这个服务器,同时开启泛域名解析,将泛域名也解析到这个服务器。
我的域名托管在namesilo,设置顶级域名解析的时候,不能使用@,也不能空着什么都不填,而是要使用一个空格代替,这样的话,就可以解析wifizoo.net到服务器的IP了。
然后在家里的路由器上运行frpc客户端,子域名选择blog,对应的主机指向家里的服务器。
这样,就可以成功实现访问blog.wifizoo.net,效果相当于访问家里的服务器。再也不担心数据丢失的问题了。
远程主机是linux+mysql,需要在本地使用navicat来管理数据库。结果连接报错lost connection to mysql server at waiting for initial communication packet
果断排查原因。
先编辑/etc/my.cnf 在[mysqld]下面首行添加禁止DNS解析参数
[mysqld]
skip-name-resolve
重启mysql,测试错误依旧。
想了一下 大约是mysql未开启远程访问权限,于是进去phpmyadmin将root用户设置为任意主机访问权限
用户 主机 密码 全局权限 授权 操作
root % 是 ALL PRIVILEGES 是
重启mysql,错误依旧
继续研究,发现是远程主机上的访问控制没有开启所致。
修改/etc/hosts.allow 添加如下行
mysqld:ALL:ALLOW
mysqld-max:ALL:ALLOW
保存,重启服务器
问题解决。
直接从官方的getting started起步做就行了
http://www.authpuppy.org/doc/Getting_Started
几个问题点。
添加官方提供的配置文件到/etc/apache2/httpd.conf,然后重启apache,报错。
root@ubuntu2:/var/www# service apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
Action ‘start’ failed.
The Apache error log may have more information.
[fail]
无法重新启动,其实原因不是域名问题,是authpuppy日志文件目录不存在,手工添加目录及文件即可成功重新启动。
ErrorLog /var/log/apache2/authpuppy/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/authpuppy/access.log combined
root@ubuntu2:/var/www# service apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
其他就没了 直接next去安装就好。
先安装ubuntu-12.04.3-server-i386,然后在最后选择安装程序包的时候 选择安装web server,安装好lamp环境。
然后运行”check_configuration.php”看一看 发现有xsl apc 没安装
另外short_open_tag set to off,需要在php配置文件中设置。
先搞定xsl,apt-get install php5-xsl搞定。
然后再运行下检测程序,发现还有两个错误 一个个解决它
******************************** * * * symfony requirements check * * * ******************************** php.ini used by PHP: /etc/php5/apache2/php.ini ** Mandatory requirements ** OK PHP version is at least 5.2.4 (5.3.10-1ubuntu3.11) ** Optional checks ** OK PDO is installed OK PDO has some drivers installed: mysql OK PHP-XML module is installed OK XSL module is installed OK The token_get_all() function is available OK The mb_strlen() function is available OK The iconv() function is available OK The utf8_decode() is available OK The posix_isatty() is available [[WARNING]] A PHP accelerator is installed: FAILED *** Install a PHP accelerator like APC (highly recommended) *** [[WARNING]] php.ini has short_open_tag set to off: FAILED *** Set it to off in php.ini *** OK php.ini has magic_quotes_gpc set to off OK php.ini has register_globals set to off OK php.ini has session.auto_start set to off OK PHP version is not 5.2.9下载APC的源码包,丢到/mnt下,进去按着INSTALL一做 发现phpsize没有。
apt-get install php5-dev 安装完毕 搞定phpsize然后 ./configure --with-php-config=/usr/bin/php-config再make。发现没有安装make,只能先apt-get install make然后make。
报错。
错误是啥记不清了 大概就是/usr/include/php5/ext/pcre这个目录下面php_pcre.h文件里面的29行中
#include "pcrelib/pcre.h" #else #include "pcre.h" 但是这个目录里面没有这货!
擦 真是坑爹啊 因为我的lamp是直接用的二进制安装的,没有源码,所以pcre.h这货自然也不存在。
怒了,找到php5.3.17的源码,解压,找的ext里面的pcre,一股脑全部复制到/usr/include/php5/ext/下面,再运行make,还是报错,貌似这回是else语句的pcre.h没有。
恼火,去pcrelib把pcre.h复制到pcre根目录下面,再make,终于解决问题。
然后去/etc/php5/apache2/php.ini在末尾追加以下配置
extension=apc.so apc.enabled=1 apc.shm_size=128 apc.ttl=7200 apc.user_ttl=7200 apc.enable_cli=1然后保存。重启apache,搞定下一个问题, [[WARNING]] php.ini has short_open_tag set to off: FAILED 去/etc/php5/apache2/php.ini查找 short_open_tag on 改成off 保存重启apache即可
安装了phpok玩玩,发现页脚版权实在不爽,查找了半天foot文件,页脚版权信息不是在foot文件中。
郁闷,写了个脚本,查找子目录下所有文件中包含“你有什么问题,请登录我们的论坛进行讨论或发邮件 ”,终于发现原来是安装时候写在数据库里面了。擦,被忽悠了半天!
对应数据库里面database_phpok中第23行数据,修改typetext内容即可。
母鸡是Q110,ATOM CPU,2G RAM。
WIN下面用vmware虚拟小鸡,unixbench得分如下:
========================================================================
BYTE UNIX Benchmarks (Version 5.1.2)
System: ubuntu: GNU/Linux
OS: GNU/Linux — 2.6.24-16-server — #1 SMP Thu Apr 10 13:58:00 UTC 2008
Machine: i686 (unknown)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Atom(TM) CPU 230 @ 1.60GHz (3222.0 bogomips)
MMX, Physical Address Ext, SYSENTER/SYSEXIT
08:36:59 up 9:07, 1 user, load average: 0.05, 0.02, 0.00; runlevel 2
————————————————————————
Benchmark Run: Thu Aug 19 2010 08:36:59 – 09:05:22
1 CPU in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 2680248.6 lps (10.0 s, 7 samples)
Double-Precision Whetstone 529.4 MWIPS (10.1 s, 7 samples)
Execl Throughput 301.3 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 64000.7 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 17947.4 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 206245.4 KBps (30.0 s, 2 samples)
Pipe Throughput 129787.1 lps (10.0 s, 7 samples)
Pipe-based Context Switching 9248.0 lps (10.0 s, 7 samples)
Process Creation 544.4 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 560.7 lpm (60.1 s, 2 samples)
Shell Scripts (8 concurrent) 72.0 lpm (60.4 s, 2 samples)
System Call Overhead 149410.0 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 2680248.6 229.7
Double-Precision Whetstone 55.0 529.4 96.3
Execl Throughput 43.0 301.3 70.1
File Copy 1024 bufsize 2000 maxblocks 3960.0 64000.7 161.6
File Copy 256 bufsize 500 maxblocks 1655.0 17947.4 108.4
File Copy 4096 bufsize 8000 maxblocks 5800.0 206245.4 355.6
Pipe Throughput 12440.0 129787.1 104.3
Pipe-based Context Switching 4000.0 9248.0 23.1
Process Creation 126.0 544.4 43.2
Shell Scripts (1 concurrent) 42.4 560.7 132.2
Shell Scripts (8 concurrent) 6.0 72.0 120.0
System Call Overhead 15000.0 149410.0 99.6
========
System Benchmarks Index Score 103.9
母鸡跑ubuntu8.03,无图形界面,用XEN虚拟小鸡,测试得分如下:
========================================================================
BYTE UNIX Benchmarks (Version 5.1.2)
System: ubuntu: GNU/Linux
OS: GNU/Linux — 2.6.24-30-xen — #1 SMP Mon Jan 2 23:00:29 UTC 2012
Machine: i686 (unknown)
Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968")
CPU 0: Intel(R) Atom(TM) CPU N270 @ 1.60GHz (3195.2 bogomips)
Hyper-Threading, MMX, Physical Address Ext
08:07:09 up 6:22, 1 user, load average: 0.10, 0.03, 0.01; runlevel 2
————————————————————————
Benchmark Run: Sun Jan 22 2012 08:07:09 – 08:35:25
1 CPU in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 3945339.5 lps (10.0 s, 7 samples)
Double-Precision Whetstone 547.2 MWIPS (10.1 s, 7 samples)
Execl Throughput 689.5 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 146292.0 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 41895.1 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 382930.7 KBps (30.0 s, 2 samples)
Pipe Throughput 316828.8 lps (10.0 s, 7 samples)
Pipe-based Context Switching 54376.5 lps (10.0 s, 7 samples)
Process Creation 1684.5 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 986.1 lpm (60.1 s, 2 samples)
Shell Scripts (8 concurrent) 132.2 lpm (60.4 s, 2 samples)
System Call Overhead 420330.7 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 3945339.5 338.1
Double-Precision Whetstone 55.0 547.2 99.5
Execl Throughput 43.0 689.5 160.3
File Copy 1024 bufsize 2000 maxblocks 3960.0 146292.0 369.4
File Copy 256 bufsize 500 maxblocks 1655.0 41895.1 253.1
File Copy 4096 bufsize 8000 maxblocks 5800.0 382930.7 660.2
Pipe Throughput 12440.0 316828.8 254.7
Pipe-based Context Switching 4000.0 54376.5 135.9
Process Creation 126.0 1684.5 133.7
Shell Scripts (1 concurrent) 42.4 986.1 232.6
Shell Scripts (8 concurrent) 6.0 132.2 220.3
System Call Overhead 15000.0 420330.7 280.2
========
System Benchmarks Index Score 230.2
XEN完胜Vmware。
在服务器上安装phpMyAdmin,出现这样的提示:
Wrong permissions on configuration file, should not be world writable!
查资料一看,原来phpMyAdmin要在755权限下才能正常工作(777不行)。所以解决办法也就来了:
SSH,cd到phpMyAdmin上级目录,
chmod -R 755 phpMyAdmin