MySQL | php |
---|---|
Wordpress_CN 4.9 | nginx |
CentOS 7.2 | 192.168.100.10 |
yum -y install openssl*
进入lnmp目录
[root@localhost lnmp]# yum -y install libzip-0.10.1-8.el7.x86_64.rpm
[root@localhost lnmp]# rpm -ivh php-common-5.4.16-46.1.el7_7.x86_64.rpm
[root@localhost lnmp]# rpm -ivh php-fpm-5.4.16-46.1.el7_7.x86_64.rpm --force --nodeps
[root@localhost lnmp]# rpm -ivh nginx-1.16.1-1.el7.ngx.x86_64.rpm --force --nodeps
[root@localhost lnmp]# rpm -ivh php-pdo-5.4.16-46.1.el7_7.x86_64.rpm
[root@localhost lnmp]# rpm -ivh php-mysql-5.4.16-46.1.el7_7.x86_64.rpm
[root@localhost lnmp]# cd
[root@localhost ]# yum -y install maraidb maraidb-server
启动nginx,mariadb,并初始化mairadb
systemctl start maraidb
/usr/sbin/nginx
mysql_secure_installation #设置数据库root用户密码
编辑配置文件 vi /etc/nginx/conf.d/default.conf
修改第 10 30-36行
location / {
root /usr/share/nginx/wordpress/;
index index.php index.html index.htm; //在这里加上 index.php
}
location ~ \.php$ {
root /usr/share/nginx/wordpress/; //修改为网站目录
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; //修改 /scripts 为 $document_root
include fastcgi_params;
}
编辑php-fpm配置文件
[root@localhost ~]# vi /etc/php-fpm.d/www.conf
修改 39 41行文件 将apache变为 nginx
启动php
[root@localhost ~]# systemctl start php-fpm
# wget https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz
tar -zxf wordpress-4.9-zh_CN.tar.gz
MariaDB [(none)]> create database `wordpress-db`;
MariaDB [(none)]> grant all privileges on `wordpress-db`.* to 'wordpress'@'localhost' identified by '000000';
MariaDB [(none)]> flush privileges;
[root@server ~]# cp wordpress/wp-config-sample.php wordpress/wp-config.php
[root@server ~]# vi wordpress/wp-config.php
更改权限
[root@localhost ~]# chown -R nginx:nginx /usr/share/nginx/
cp -r wordpress/* /usr/share/nginx/html/
移除原有目录的页面文件
mv /usr/share/nginx/html/* /opt/
[root@server ~]# systemctl restart mariadb
[root@server ~]# /usr/sbin/nginx -s reload
192.168.100.10/wp-admin