wordpress安装

1.安装php(我选的版本是5.6.2)

(1) 安装依赖环境

yum install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel openssl-devel -y

 

还有一个依赖需要用源码装:

# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
# tar xf libmcrypt-2.5.7.tar.gz
# cd libmcrypt-2.5.7
# ./configure --prefix=/usr/local/libmcrypt && make && make install

 

(2) 编译php

# cd /usr/local/src/
# wget http://cn2.php.net/distributions/php-5.6.2.tar.gz
# tar xf php-5.6.2.tar.gz
# cd php-5.6.2
# ./configure --prefix=/usr/local/php-5.6.2 \
--with-config-file-path=/usr/local/php-5.6.2/etc \
--enable-fpm --with-fpm-user=php-fpm --with-mysql=mysqlnd \
--with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir \
--with-freetype-dir --with-iconv-dir --with-zlib-dir \
--with-mcrypt=/usr/local/libmcrypt \
--enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring \
--enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl
# make && make install

 

(3) 启动php-fpm

# cp /usr/local/src/php-5.6.2/php.ini-production /usr/local/php-5.6.2/etc/
# cd /usr/local/php-5.6.2/etc/
# cp php-fpm.conf.default php-fpm.conf
# groupadd php-fpm
# useradd -g php-fpm -s /sbin/nologin php-fpm
# vim php-fpm.conf
---------------
user = php-fpm
group = php-fpm
---------------
# cp /usr/local/src/php-5.6.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chmod +x /etc/init.d/php-fpm
# /etc/init.d/php-fpm start

 

2. 安装数据库

# tar xf mysql-5.5.54-linux2.6-x86_64.tar.gz -C /usr/local/
# cd /usr/local/
# mv mysql-5.5.54-linux2.6-x86_64 mysql
# groupadd mysql
# useradd -g mysql -s /sbin/nologin mysql
#  cd /usr/local/mysql/scripts/
#  ./mysql_install_db --basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data --user=mysql
# chown -R mysql:mysql /usr/local/mysql
# cp /etc/my.cnf /etc/my.cnf.bak
# cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld

 

添加环境变量:

# vim /etc/profile
在末尾添加:
PATH=$PATH:/usr/local/mysql/bin
export PATH

 

创建数据库:

mysql > create database wordpress;
mysql > grant all on wordpress.* to 'wp'@'localhost' identified by 'wp';
mysql > flush privileges;

 

3.配置Nginx

# vim /usr/local/nginx/conf/nginx.conf
--------------------------------
location / {
  root html;
  index index.php index.html index.htm;
}
location
~ \.php$ {   root html;   fastcgi_pass 127.0.0.1:9000;   fastcgi_index index.php;   fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;   include fastcgi_params; } ---------------------------------

# /usr/local/nginx/sbin/nginx 启动Nginx

 

4.下载配置wordpress

# wget https://cn.wordpress.org/wordpress-4.5.3-zh_CN.tar.gz
# tar xf wordpress-4.5.3-zh_CN.tar.gz
# cp -r wordpress/* /usr/local/nginx/html/
# cd /usr/local/nginx/html
# cp wp-config-sample.conf wp-config.conf
# vim wp-config.conf
------------------------------
define('DB_NAME', 'wordpress');
define('DB_USER', 'wp');
define('DB_PASSWORD', 'wp');
define('DB_HOST', '127.0.0.1');  // 注意此处一定写127.0.0.1,因为写localhost和主机IP无效
-------------------------------

 

5.浏览器访问

http://www.example.com

http://IP

posted @ 2017-05-19 15:28  道霖  阅读(219)  评论(0编辑  收藏  举报