centos7.3安装wordpress
一、安装并配置数据库
1.安装mariadb
#yum install -y mariadb-server mariadb
2.启动数据库并设置开机自启
#systemctl start mariadb &&systemctl enable mariadb
3.初始化数据库
#mysql_secure_installation
4.登录数据库并创建wordpres库
#mysql -u root -p
>create database wordpress;
>grant all privileges on wordpress.* to 'wordpress'@'localhost' identified by 'wordpress';
>grant all privileges on wordpress.* to 'wordpress'@'%' identified by 'wordpress';
二、安装Apache+php7
1.安装apache
#yum install -y httpd &&systemctl enable httpd &&systemctl start httpd
2.安装php
#yum install -y epel-release && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 -y
3.配置apache
删除欢迎页
#rm -rf /etc/httpd/conf.d/welcome.conf
#vi /etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html #添加对PHP的支持
三、下载wordpress中文版
#cd /opt
#yum install -y wget
#wget https://cn.wordpress.org/wordpress-4.9.1-zh_CN.tar.gz
#tar -xzvf wordpress-4.9.1-zh_CN.tar.gz
#cp -r wordpress/* /var/www/html/
四、重启服务apache#systemctl restart httpd
五、访问http://your_ip
如果报错,更改html属主,属组 (不改属组属主在后期升级或导致没有权限创建文件或写入)
chown apache. -R html/
附:更改对上传文件大小的限制:
#vi /etc/php.ini
#找到下面3行,更改值
upload_max_filesize = 2M post_max_size = 8M max_execution_time = 30
六、解决安装WordPress主题及插件需要输入FTP问题(https://jingyan.baidu.com/article/4f34706efc1237e387b56da4.html)(没有验证过)
在wp-config.php文件中添加脚本方式
define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);