Ubuntu下搭建WordPress

根据WordPress的官方文档,想要安装WordPress的话需要如下必要条件:

 

  • PHP version 5.2.4 or greater

  • MySQL version 5.0 or greater

We recommend Apache or Nginx as the most robust and featureful server for running WordPress, but any server that supports PHP and MySQL will do. That said, we can’t test every possible environment andeach of the hosts on our hosting page supports the above and more with no problems.

当然我用的是EC2提供的Ubuntu服务器,就用Apache服务器好了,这样URL静态化什么的比较容易。

首先更新操作系统

sudo apt-get update
sudo apt-get dist-upgrade

然后执行如下命令,安装各类软件:

#mysql-server
sudo apt-get install
#安装apache服务器
sudo apt-get install apache2
#安装php支持
sudo apt-get install php5
#安装php5的mysql模块
sudo apt-get install php5-mysql
#安装mysqllnd
sudo apt-get install php5-mysqlnd
#安装gd库
sudo apt-get install php5-gd

其实第一次安装WordPress的话是不需要以上全部的,但是安装了有备无患。

下载WordPress(这个项目红红火火啊)

你可以直接下载这个地址的压缩包:http://cn.wordpress.org/wordpress-3.5.1-zh_CN.tar.gz,也可以自己去WordPress的SVN上下载源码:http://i18n.svn.wordpress.org/zh_CN/

 然后解压吧,里边有个readme.html文件,里边有详细的安装过程,也有一些有用的连接

什么?你不知道上传到什么位置?不知道怎么配置apache项目路径?请参考这篇文章的http://www.liuhe36.cn/2013/04/install-discuz-on-ubuntu/第3点。

下面介绍一些网站的重定向和URL静态化的一些相关知识:

1、打开Apache的rewrite模块:sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

2、修改Apache配置文件/etc/apache2/sites-enabled/000-default的Directory属性,把AllowOverride 修改成All

3、在你的网站的目录下建立.htaccess文件

.htaccess文件(或者”分布式配置文件”)提供了针对目录改变配置的方法, 即,在一个特定的文档目录中放置一个包含一个或多个指令的文件, 以作用于此目录及其所有子目录。

如果只需要WordPress的静态化的话,到这里就可以了,因为WordPress会自动编辑这个配置文件,当然要有足够的权限。而如果想要增加301跳转的话,比如要把对www的访问重定向到不带www的域名上就需要在.htaccess文件中增加这样的记录:

RewriteCond %{HTTP_HOST} ^www.87v5.me [NC]
RewriteRule ^(.*)$ http://87v5.me/$1 [L,R=301]

 

“Ubuntu下搭建WordPress”的一个回复

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注