nginx动态网站

第一步:下载相关的软件包
[root@zxw html]# yum install nginx php php-mysql
mariadb-server php-fpm -y
第二步:编辑php匹配规则
[root@zxw html]# vim /etc/nginx/nginx.conf

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
index index.php index.html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location ~ php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
第四步:检查并重启
[root@zxw html]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@zxw html]# systemctl restart nginx
第五步:启动php-fpm
[root@zxw html]# systemctl restart php-fpm
[root@zxw html]# ss -tnl
第五步;上传包。配置数据库文件
[root@zxw html]# cd /usr/share/nginx/html/
[root@zxw html]# rz
[root@zxw html]# unzip wordpress-3.3.1-zh_CN.zip
[root@zxw wordpress]# cp wp-config-sample.php wp-config.php
[root@zxw wordpress]# vim wp-config.php

define('DB_NAME', 'zxw');

/** MySQL 数据库用户名 */
define('DB_USER', 'zxw');

/** MySQL 数据库密码 */
define('DB_PASSWORD', 'zxw');

/** MySQL 主机 */
define('DB_HOST', 'localhost');
第六步:重启数据库
[root@zxw wordpress]# systemctl restart mariadb
第七步;创建数据库用户密码
[root@zxw wordpress]# mysql -uroot
MariaDB [(none)]> create database zxw;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zxw.* to zxw@'localhost' identified by '123'
Query OK, 0 rows affected (0.00 sec)

猜你喜欢

转载自www.cnblogs.com/itzhao/p/11249954.html