安装PHP
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php72
yum search php72
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
清除版本
yum -y remove php*
安装php
yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-redis
开始跑了就说明安装正确(过程可能会有点长)
启动php-fpm服务
systemctl enable php-fpm.service
systemctl start php-fpm.service
启动php-fpm
service php-fpm start
此时PHP已经安装好了 接下来做一些基础配置
vi /etc/nginx/conf.d/default.conf 添加及修改红色的部分
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /soft/code;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /soft/code$fastcgi_script_name;
include fastcgi_params;
}
}
#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$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$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
nginx -t
nginx -s reload
新建目录
mkdir -p /soft/code
vi /soft/code/info.php
phpinfo();
?>
进入网页 http://192.168.60.4/info.php
将wordpress压缩包传入虚拟机里面 并解压
tar zxf wordpress-5.7.1-zh_CN.tar.gz
进入数据库配置
mysql -root -ptest进入数据库
create database wordpress;创建数据库
show databases; 查看数据库
grant all on wordpress.* to 'wpuser'@'localhost' identified by 'password';赋予权限
exit 退出数据库
cd wordpress
cp wp-config-sample.php wp-config.php 把源文件做备份
vi wp-config.php 编辑其备份文件
去网址192.168.60.4/wordpress
设置站点名称 密码
完成后登录