Linux/Ubuntu 10.04 + Nginx + MySql + php(FastCGI) + Phpmyadmin + WordPress
新到手一台VPS,小试一下感觉不错,发帖留念。
注:
1、本文为完成之后根据回忆写成,如有问题欢迎指正
2、大部分文本操作直接在CLI下通过shell完成
0、准备工作
sudo apt-get update
1、安装并开启Nginx
sudo apt-get intsall nginx sudo /etc/init.d/nginx start #此时访问localhost如出现"Welcome to Nginx!"页面则表明安装成功
2、安装mysql(会提示设置数据库密码)
sudo apt-get install mysql-server mysql-client
3、安装phpmyadmin并在虚拟主机根目录下建立软链接
sudo apt-get install phpmyadmin sudo ln -s /usr/share/phpmyadmin/ /var/www/heaptech.com/ #/var/www/heaptech.com 即为虚拟主机位置
4、安装php
sudo apt-get install php5 php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-sqlite php5-xsl
5、安装spawn-fcgi(控制php5-cgi的)
sudo apt-get install spawn-fcgi
6、在Nginx中配置spawn-fcgi
#在/etc/nginx/fastcgi_params文件最后添加"fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;" sudo sed -i '$ i fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' /etc/nginx/fastcgi_params
7、修改php-cgi的配置文件,把cgi.fix_pathinfo设置为1
sudo sed -i '/cgi.fix_pathinfo=/ c cgi.fix_pathinfo=1;' /etc/php5/cgi/php.ini
8、开启fastcgi并设置开机启动
#1)开启 sudo /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid
#2)设置开机启动,即在/etc/rc.local中添加"/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid" sudo sed -i '/^exit/ i /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid' /etc/rc.local
9、设置Nginx中虚拟主机配置(最重要的部分)
#1)建立一个虚拟主机配置文件 sudo vim /etc/nginx/sites-available/heaptech.com #文件名任意
#2)添加下方到内容
server {
listen 80; #WordPress的访问端口(默认80)
server_name heaptech.com www.heaptech.com; #主机名称,绑定的域名
root /var/www/heaptech.com; #虚拟主机根目录
location / {
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
#3)软链接至sites-enabled文件夹 sudo ln -s /etc/nginx/sites-available/heaptech.com /etc/nginx/sites-enabled/
10、安装wordpress
cd /var/www/heaptech.com #虚拟主机根目录 sudo wget http://wordpress.org/latest.tar.gz sudo tar -zxvf latest.tar.gz sudo mv wordpress/* . sudo chmod -R 755 wp-content/ #权限问题还有一点不是很明白,欢迎指教(怎样最安全?) sudo cp wp-config-sample.php wp-config.php sudo sed -i -e 's/database_name_here/数据库名称/' -e 's/username_here/数据库用户名/' -e 's/password_here/数据库密码/' -e 's/localhost/主机名称/' -e '$ i define(‘WP_POST_REVISIONS’, false);' wp-config.php #需将命令中的中文替换为对应值
11、Last but not least
sudo /etc/init.d/nginx restart #至此,所有安装工作全部完成 #http://heaptech.com即为blog地址 #http://heaptech.com/phpmyadmin/为phpmyadmin
用Mail to Commenter & Configure SMTP实现邮件回复评论
终于搞定了邮件回复评论功能,贴在这里
安装了两个插件:1、Mail To Commenter;2、Configure SMTP;
相关关键配置截图如下:


一点说明:
我是设置通过Gmail的SMTP服务,然后以域名邮箱的身份发送的,后者可以省略,即Sender e-mail和Sender name的参数设置。但需要注意的是,SMTP需要验证发件人,所以必须和管理员的邮箱一致,这也是我为什么自定义Sender e-mail的原因
Some WordPress Plugins Recommended
闲来无事,推荐几个我觉得比较实用的Plugin吧~~(排名不分先后)
1、Chinese Word Count
WP后台日志发布页面中,Word Count貌似不支持中文,有了这个就不怕了~~
2、Some Chinese Please!
要求评论中必须有汉字,可以防止Spam机器人,因为主要是国外才有……
3、WP Greet Box
一个可以针对浏览来源设定不同欢迎信息的插件,可以推广网站而又不显得太突兀
4、Ozh’ Better Feed
可以在Feed中添加Footer,简单方便(不过我没有使用,还是觉得直接改主题代码更好一点,过些天再整理出来~)
5、OpenID
让你的Blog支持OpenID,不知道什么是OpenID?请猛击这里
其他的在之前已经推荐过,这里只列出名字,加上了本次推荐的,方便重装的时候参照~
(有删减,毕竟有的是会被淘汰的~)
(按照Plugin列表中的顺序)
Akismet Chinese Word Count Google XML Sitemaps Mail To Commenter OpenID Ozh' Better Feed Some Chinese Please! Syntax Highlighter for WordPress Twitter Tools WordPress Database Backup WordPress Related Posts WP-Cumulus WP-PageNavi WP Greet Box
期待新主页ing
为了迎接Catt给我设计的个人主页,给blog换了套主题,留下点东西,方便以后用。
另外欢迎各位亲朋好友留下脚印,方便我收集一下大家的博客链接,我好做Blogroll啊!
1、关闭Wordpress的修订功能
在根目录下的wp-config.php中,添加
define('WP_POST_REVISIONS',false);
2、Plugin
Akismet WP-PageNavi Google XML Sitemaps WordPress Related Posts Mail to Commenter Twitter Tools Syntax Highlighter for WordPress bShare 分享 WordPress Database Backup WP-Cumulus
3、Google analytics
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-11029434-5");
pageTracker._setDomainName(".huxuan.org");
pageTracker._trackPageview();
} catch(err) {}</script>
4、重定向
# BEGIN user-defined
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator|feedsky) [NC]
RewriteCond %{REQUEST_URI} ^/feed.* [NC]
RewriteRule .* http://feeds.huxuan.org/ [NC,L,R=301]
</ifModule>
贴一张旧主题的照片纪念一下,地点是GoogleCamp实验室,台式机+笔记本,显示的都是原来主题的效果,拍完了才发现还是挺有感觉的……(如果看不到,我就不多说了,如果有比flickr更好的提供外链图片的网站,尽快告诉我吧!)

A recommended kind of RSS solution
Today I want to recommend a kind of RSS solution and it’s just what I use for my blog.
In this way, we will have a permanent and unique rss url. As for me, it’s http://feeds.huxuan.org/huxuan
1)Sign up as the same name for your feed in FeedSky & FeedBurner.
e.g. I have
http://feed.feedsky.com/huxuan for FeedSky &
http://feeds.feedburner.com/huxuan for FeedBurner
(I just have it for example, Please don’t subscribe my blog through this two address)
2) Use the Domain Binding Service which Feedburner & Feedsky both provide to host the feed by your own domain name
You should choose only one of the two & Feedburner is recommended absolutely
You need to create a CNAME entry in the DNS records here
More information are provided by Feedburner & Feedsky when you configure the Domain Binding Service
3) Change the feed source you didn’t choose in step 2
e.g. I choose Feedburner to create the feed, so I change the feed source of Feedsky just into http://feeds.huxuan.org/huxuan.
4)Change the default rss url of wordpress
In the header.php of theme we use, similar code can be found like this:
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="http://blog.huxuan.org/feed" />Change the url with underline into the feed you have created.
5)Change all possible default feed url on the site
There may be many default feed url list on the site most presenting as a link of an image or some else.
Just search for it and change it!
Attention: Some Errors happen in Step 6. Ignore it now.
6)Redirect the default feed url to the new one just in case
Insert the code below to .htacess which located in the main directory# redirect default feed url to the permanent one Redirect /feed http://feeds.huxuan.org/huxuan
7)Now all steps is done, just share your unique & permanet feed url to your friends
if one of the two feed service providers don’t work, just change to the other one via repeating Step 2 & 3






