Written by 正冰 on 2013, January 14, 12:28 PM
定位文件:\e\search\result\index.php
打开并搜索$changerow+=1;语句,在它上面增加如下高亮关键词语句:
$r[title]=str_replace($search_r[keyboard],"<font color='red'>$search_r[keyboard]</font>",$r[title]);
保存搞定。
Filed under: 技术归总
0 Comments
6894 Views
Written by 正冰 on 2013, January 7, 5:35 AM
需求说明:godaddy主机空间性能比较强劲,正冰购买的 Godaddy Deluxe Linux美国主机空间配置如下:
- CPU为8核心的Intel(R) Xeon(R) CPU L5609 @ 1.87GHz
- 内存 48 GB
- 空间 150 GB
- 无限流量
- 数据库 25 个 MySQL 数据库(每个限制 1 GB)
这么强劲的主机空间是挺不错的,无奈的是Godaddy主机空间有一个弊端,就是线路不佳,访问速度不快,而且时而会抽风。那么就需要一个可以解决抽风弊端并且可以让国内用户享受高性能Godaddy主机空间的廉价方案。
正冰给的解决方案:一台线路稳定并且速度不算慢的美国VPS(正冰选择了buyvm家的15美元年付128M内存,突发256M内存的VPS),安装nginx作为前端反向代理Godaddy主机空间,这样就完美解决了这个问题。
购买VPS,安装Nginx这些就不多说了,正冰直接采用lnmp一键安装包方便讲解:
开始讲解之前先约定信息:Godaddy主机空间IP为111.111.111.111,VPS的IP为222.222.222.222,需要反向代理的域名为blog.is36.com,将域名直接解析到222.222.222.222。
1、先在Godaddy主机空间正常绑定需要反向代理的网站域名blog.is36.com(注意:若需要反向代理www开始的域名比如www.is36.com会提示不允许www,那么只要绑定is36.com域名就可以了,Godaddy已经帮你把is36.com与www.is36.com都绑定上去了)
2、编辑Nginx的主配置文件/usr/local/nginx/conf/nginx.conf,在server{这个关键词上方加入如下代码(Nginx反向代理配置代码):
- client_body_buffer_size 512k;
- proxy_connect_timeout 5;
- proxy_read_timeout 60;
- proxy_send_timeout 5;
- proxy_buffer_size 16k;
- proxy_buffers 4 64k;
- proxy_busy_buffers_size 128k;
- proxy_temp_file_write_size 128k;
- proxy_temp_path /home/cache/temp;
- proxy_cache_path /home/cache/path levels=1:2 keys_zone=cache_one:128m inactive=2d max_size=10g;
以上配置最后一条语句的含义为:设置Web缓存区名称为cache_one,内存缓存空间大小为128MB,2天没有被访问的内容自动清除,硬盘缓存空间大小为10GB。
3、然后执行如下命令增加反向代理的缓存目录:
- mkdir -p /home/cache/temp
- mkdir -p /home/cache/path
4、修改VPS(CentOS系统)上的hosts文件/etc/hosts,执行如下命令(按实际修改):
- echo "111.111.111.111 blog.is36.com">>/etc/hosts
这一条是让VPS可以把blog.is36.com解析到111.111.111.111(Godaddy主机空间)取数据。
5、增加需要反向代理的配置文件(实际操作请把下面所有blog.is36.com字符串替换为你反向代理的网站域名即可):vi /usr/local/nginx/conf/vhost/blog.is36.com.conf
- server
- {
- listen 80;
- server_name blog.is36.com;
- access_log /home/wwwlogs/blog.is36.com.log access;
- location / {
- proxy_cache cache_one;
- proxy_cache_valid 200 304 3d;
- proxy_cache_key $host$uri$is_args$args;
- proxy_pass http://blog.is36.com;
- proxy_redirect off;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- expires 12h;
- }
-
- location ~ .*\.(php|jsp|cgi)?$
- {
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_pass http://blog.is36.com;
- }
- }
6、测试nginx配置信息以及重新加载nginx配置信息:
- /usr/local/nginx/sbin/nginx -t
- /usr/local/nginx/sbin/nginx -s reload
7、把网站程序通过ftp上传到Godaddy主机空间即可,注意ftp连接地址填写为111.111.111.111
以上配置可以让前端缓存网站的文件,加速客户端的读取,若不想让前端缓存文件,则文件/usr/local/nginx/conf/vhost/blog.is36.com.conf内容如下:
- server
- {
- listen 80;
- server_name blog.is36.com;
- location / {
- proxy_pass http://blog.is36.com;
- proxy_redirect off;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- }
- }
Filed under: 技术归总
0 Comments
16935 Views
Written by 正冰 on 2012, December 31, 4:17 AM
在groupon网站购物会留下信用卡信息,而为了保障信用卡安全,可以在购物完成后删除信用卡信息,方法如下:
Sign In -> My Account -> Credit Cards -> Billing Info -> remove
Filed under: 网络杂事
0 Comments
10012 Views
Written by 正冰 on 2012, December 20, 4:41 AM
发表这篇博文让我再次吐槽一下:娱乐问题找百度,技术问题找Google!all in one seo
言归正传,在给某个wordpress博客系统安装了All in One SEO Pack 1.6.15.3插件并配置启用以后,出现一个问题,除了首页的标题信息正常显示,其他内容页面的标题处会如下显示:
文章标题+博客标题 | 博客标题
%post_title%%blog_title% | %blog_title%
也就是说博客标题多出了一次,第一次的博客标题是个bug,通过google找到如下网址解决了问题:http://semperfiwebdesign.com/forum/install-upgrade-all-in-one-seo-pack/post-title-showing-as-post_titleblog_title-blog_title/
原来bug跟主题有关,解决的办法很简单,只要把博客主题中functions.php文件中的一行代码屏蔽掉即可,我使用的是默认最新主题twentytwelve,定位到functions.php文件185行使用双斜杠屏蔽即可,其他主题请类似操作。
//add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );
Filed under: 技术归总
1 Comments
29229 Views
Written by 正冰 on 2012, November 28, 12:47 PM
手里有一台Linode的vps从购买那天至今从未宕机过(持续在线时间:161天),因为业务上暂时不需要了,就先取消掉好了。
比较人性化的事情就是取消掉的VPS会当机把该支付周期内的尾款按照天数退回至账户余额。
我的这款VPS位于日本机房,配置如下:
CPU:4核心Intel(R) Xeon(R) L5520 @ 2.27GHz
- 内存:512M
- SWAP:512M
- 硬盘:20GB
- 价格:19.95美元/月
- 支付方式:双币信用卡
所在母鸡IP:tokyo83.linode.com [106.187.33.95]
VPS分配的IP:106.187.98.14X
如果本文对你有帮助并且你需要购买,这是我的推介通道:
http://www.linode.com/?r=a2771ffdad86fad8ad4d07eeb7e661812bdbd906
Filed under: 技术归总
0 Comments
15946 Views
Written by 正冰 on 2012, November 23, 9:44 PM
晚上转了一笔paypal给国内的账户,然后看了下PayPal国内账户付款转账手续费情况,如下:
国内pp账户转账有两种:
- 从余额转账,手续费:1.5%+0.3USD
- 从借记卡(信用卡)转账, 手续费:3.4%+0.3USD
不过来自PayPal的客服提醒这种操作不宜过多, PayPal可能会认为存在风险操作,会限制账户。
另外,来自跨国的收款交易,手续费是:3.9%+0.3USD
Filed under: 网络杂事
0 Comments
9372 Views
Written by 正冰 on 2012, November 8, 4:00 PM
今天在测试一款云主机产品(其实就是VPS),国内喜欢偷换概念卖产品……
云主机可以安装Windows2003与CentOS6.2系统,在测试的过程中我将Windows2003系统切换至CentOS6.2系统后发现110G的数据盘丢失了……
这是个神奇的事情,本想直接让客服来搞,想想有时间就自己看了下,把数据盘都弄出来了。
过程如下:
[root@localhost ~]# df -h
- 文件系统 容量 已用 可用 已用%% 挂载点
- /dev/mapper/VolGroup-lv_root
- 7.5G 1.2G 5.9G 17% /
- tmpfs 2.5G 0 2.5G 0% /dev/shm
- /dev/sda1 485M 65M 395M 14% /boot
[root@localhost ~]# ll /dev/sd*
- brw-rw---- 1 root disk 252, 0 11月 8 12:55 /dev/sda
- brw-rw---- 1 root disk 252, 1 11月 8 12:55 /dev/sda1
- brw-rw---- 1 root disk 252, 2 11月 8 12:55 /dev/sda2
- brw-rw---- 1 root disk 252, 16 11月 8 12:55 /dev/sdb
[root@localhost ~]# fdisk /dev/sdb
- Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
- Building a new DOS disklabel with disk identifier 0xadb9341e.
- Changes will remain in memory only, until you decide to write them.
- After that, of course, the previous content won't be recoverable.
-
- Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
-
- WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
- switch off the mode (command 'c') and change display units to
- sectors (command 'u').
-
- Command (m for help): p
-
- Disk /dev/sdb: 118.1 GB, 118111600640 bytes
- 16 heads, 63 sectors/track, 228855 cylinders
- Units = cylinders of 1008 * 512 = 516096 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0xadb9341e
-
- Device Boot Start End Blocks Id System
-
- Command (m for help): new
- Command action
- e extended
- p primary partition (1-4)
- p
- Partition number (1-4): 1
- First cylinder (1-228855, default 1):
- Using default value 1
- Last cylinder, +cylinders or +size{K,M,G} (1-228855, default 228855):
- Using default value 228855
-
- Command (m for help): p
-
- Disk /dev/sdb: 118.1 GB, 118111600640 bytes
- 16 heads, 63 sectors/track, 228855 cylinders
- Units = cylinders of 1008 * 512 = 516096 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0xadb9341e
-
- Device Boot Start End Blocks Id System
- /dev/sdb1 1 228855 115342888+ 83 Linux
-
- Command (m for help): w
- The partition table has been altered!
-
- Calling ioctl() to re-read partition table.
- Syncing disks.
[root@localhost ~]# mkfs -t ext3 /dev/sdb1
- mke2fs 1.41.12 (17-May-2010)
- 文件系统标签=
- 操作系统:Linux
- 块大小=4096 (log=2)
- 分块大小=4096 (log=2)
- Stride=0 blocks, Stripe width=0 blocks
- 7208960 inodes, 28835722 blocks
- 1441786 blocks (5.00%) reserved for the super user
- 第一个数据块=0
- Maximum filesystem blocks=0
- 880 block groups
- 32768 blocks per group, 32768 fragments per group
- 8192 inodes per group
- Superblock backups stored on blocks:
- 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
- 4096000, 7962624, 11239424, 20480000, 23887872
-
- 正在写入inode表: 完成
- Creating journal (32768 blocks): 完成
- Writing superblocks and filesystem accounting information: 完成
-
- This filesystem will be automatically checked every 39 mounts or
- 180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mkdir /data
[root@localhost ~]# mount -t ext3 /dev/sdb1 /data
[root@localhost ~]# df -h
- 文件系统 容量 已用 可用 已用%% 挂载点
- /dev/mapper/VolGroup-lv_root
- 7.5G 1.2G 5.9G 17% /
- tmpfs 2.5G 0 2.5G 0% /dev/shm
- /dev/sda1 485M 65M 395M 14% /boot
- /dev/sdb1 109G 188M 103G 1% /data
[root@localhost ~]# echo "/dev/sda1 /data ext3 defaults 0 0">>/etc/fstab
Filed under: 技术归总
0 Comments
8564 Views
Written by 正冰 on 2012, November 8, 1:38 PM
执行如下指令即可:
echo "export LC_ALL=C">>/etc/profile
Filed under: 技术归总
0 Comments
17610 Views