CentOS6系统LNMP环境搭建及WordPress安装
1. 安装nginx
查询nginx安装包
yum list nginx
发现没有nginx的rpm包,所以需要先从http://nginx.org/packages/centos/6/noarch/RPMS/更新rpm依赖库
rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
安装nginx
yum install nginx
启动nginx
service nginx start
通过ip访问可以看到
将nginx设置为开机自启
chkconfig nginx on
chkconfig | grep nginx
2. 安装mysql
查询mysql安装包
yum list mysql*
mysql的版本太低,从https://dev.mysql.com/downloads/repo/yum/选择相应的rpm包
rpm -Uvh https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm
编辑repo文件,选择mysql5.7,注意: 不要安装mysql8.0,否则会导致wordpress安装报错
vim /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1 # 设置为1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/
enabled=0 # 设置为0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
安装mysql
yum install mysql-server
启动mysql
service mysqld start
将mysql设置为开机自启
chkconfig mysqld on
chkconfig | grep mysqld
查看root用户默认密码
grep "password" /var/log/mysqld.log
登陆mysql
mysql -uroot -p
设置root用户密码
alter user 'root'@'localhost' identified by '新密码';
flush privileges;
重启mysql
service mysqld restart
3. 安装php
查询php安装包
yum list php
同样版本太低,更新rpm包
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
安装php以及wordpress必需的组件
yum install php70w php70w-mysql php70w-fpm
启动php-fpm
service php-fpm start
将php-fpm设置为开机自启
chkconfig php-fpm on
chkconfig | grep php-fpm
4. 安装并配置wordpress
从https://cn.wordpress.org/txt-download/下载wordpress
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
解压到/home/目录下
tar -zxvf wordpress-4.9.4-zh_CN.tar.gz -C /home/
登陆mysql并添加数据库,命名为wordpress
mysql -uroot -p
create database wordpress;
show databases;
备份nginx的配置文件
cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
修改配置文件
vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name www.xxx.com; # 你的域名或ip
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
root /home/wordpress; # wordpress根目录
index index.html index.htmi index.php;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
重启nginx
service nginx restart
通过浏览器访问你的域名或ip
填写mysql的用户名和密码
报错,显示不能写入wp-config.php文件
查看wordpress文件夹,发现是权限问题
ll /home | grep wordpress
查看用户和用户组
grep -E '^(user|group)' /etc/php-fpm.d/www.conf
设置访问权限
chown -R apache:apache /home/wordpress
这次没有报错,安装成功
参考链接
Centos6.8 yum安装LNMP
CentOS6.5安装MySQL5.7详细教程
Nginx+php+mysql+wordpress搭建自己的博客站点
使用nginx利用虚拟主机搭建WordPress博客
centos6.5 系统-搭建lamp(php7)环境
解决wordpress下载插件,安装失败,无法创建目录问题
CentOS7 安装 mysql8
Linux(CentOS)下设置nginx开机自动启动和chkconfig管理
上一篇: Thinkphp对接华为云短信接口
下一篇: CentOS7.2 安装单机 Redis
推荐阅读
-
CentOS6系统LNMP环境搭建及WordPress安装
-
win10系统下kafka的安装及启动,配套zookeeper环境的搭建及启动
-
CentOS7 LNMP+phpmyadmin环境搭建 第一篇虚拟机及centos7安装
-
Windows系统下Eclipse搭建ESP32编译环境及安装过程
-
腾讯云主机安装LNMP环境及wordpress教程
-
Vmware虚拟机Linux系统上从php环境搭建到wordpress的安装
-
CentOS7 LNMP+phpmyadmin环境搭建 第一篇虚拟机及centos7安装
-
Vmware虚拟机Linux系统上从php环境搭建到wordpress的安装
-
详解PHP安装及lnmp完整搭建-wordpress
-
详解PHP安装及lnmp完整搭建-wordpress