阿里云服务器Linux CentOS安装配置(11)安装Wordpress

 

下载wordpress安装包

wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.zip

unzip wordpress-4.8.1-zh_CN.zip -d /var/www/html(如果目录不存在,则需要先创建 mkdir -p /var/www/html)

设置文件访问权限

        chmod -R 777 /var/www/html/wordpress

 

 

安装mysql,并创建wordpress库

yum -y install mysql-server mysql-devel

service mysqld start

mysqladmin -u root password abc,123

mysql -u root -pabc,123

create database wordpress;

 

 

安装php5.6

rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof

 

 

安装配置nginx

yum install nginx -y

配置

        vi /etc/nginx/conf.d/default.conf

        添加下面代码

                server {

                        listen 80;

                        server_name wordpress.liaolongjun.com;

                        location / {

                                proxy_pass http://127.0.0.1:81;

                                proxy_redirect off;

                                proxy_set_header Host $host;

                                proxy_set_header X-Real-IP $remote_addr;

                                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                        }

                }

启动服务

        service nginx restart

 

 

安装Apache

yum install httpd -y

配置

        vi /etc/httpd/conf/httpd.conf

        Listen 80 改成 Listen 81

        #ServerName www.example.com:80   改成  ServerName 127.0.0.1:81

        #NameVirtualHost *:80   改成  NameVirtualHost *:81

配置

        vi /etc/httpd/conf.d/welcome.conf

        添加下面代码:

                <VirtualHost *:81>

                        ServerName wordpress.liaolongjun.com

                        DocumentRoot /var/www/html/wordpress/

                        <Directory /var/www/html/wordpress>

                                Order deny,allow

                                Allow from all

                        </Directory>

                </VirtualHost>

启动服务

        service httpd restart 

 

访问下面的链接完成安装配置

http://wordpress.liaolongjun.com

管理员地址
http://wordpress.liaolongjun.com/wp-admin/ 

 

 

补充:wordpress主题安装,需要服务器端安装ftp

yum install vsftpd -y
vi /etc/vsftpd/ftpusers 删除root
vi /etc/vsftpd/user_list 删除root
service vsftpd restart

(解决问题:wordpress安装主题 无法复制文件)


mkdir /var/www/html/wordpress/wp-content/tmp
修改文件 /var/www/html/wordpress/wp-config.php
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');

在文件 wp-config.php 中找到上面描红的内容,然后在它的下面,添加下面描红的内容

define('WP_TEMP_DIR', ABSPATH.'wp-content/tmp');
define("FS_METHOD", "direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);

设置文件访问权限

        chmod -R 777 /var/www/html/wordpress
        chown root /var/www/html/wordpress

原文地址:https://www.cnblogs.com/liaolongjun/p/7607658.html