WordPress 安装简明教程

下载 wordpress

wget https://cn.wordpress.org/wordpress-4.7.4-zh_CN.zip
unzip wordpress-4.7.4-zh_CN.zip

创建数据库

mysql> create schema db_word_press;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on db_word_press.* to wordpress@'localhost' identified by 'nk-KfD6C;Z\1AZ"';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

安装 php

yum -y install libmcrypt-devel mhash-devel libxslt-devel
yum install -y libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel 
yum install -y zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel 
yum install -y  ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel 
yum install -y krb5 krb5-devel libidn libidn-devel openssl openssl-devel

wget http://php.net/get/php-7.1.7.tar.gz/from/this/mirror
tar xvf mirror

./configure --prefix=/usr/local/php  --enable-fpm --with-mcrypt --enable-mbstring --enable-pdo  --with-pdo-mysql --enable-mysqlnd --with-curl --disable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysqli --with-gd --with-jpeg-dir --with-openssl=/usr 
make all install

配置 php-fpm

groupadd www-data
useradd -g www-data www-data
chown -R www-data:www-data wordpress/
chmod 755 wordpress
cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf

配置 nginx

server {
    listen   80;
    index index.html index.php;
    server_name blog.lzxz1234.cn;
    root /opt/wordpress;

    location / {
        #index index.html index.php;
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }
    location ~ \.php$ {
        root /opt/wordpress;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
    }
}

发表回复

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