LNMP
nginx
[root@web01 ~]# cat /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
yum install nginx
php
[php-webtatic]
name = PHP Repository
baseurl= http://us-east.repo.webtatic.com/yum/el7/x86_64
gpgcheck = 0
#走的系统kylin v10 PHP7.2
yum -y install php php-bcmath php-cli php-common php-devel php-embedded php-fpm php-gd php-intl php-mbstring php-mysqlnd php-opcache php-pdo php-process php-xml php-json
mysql
[root@web01 ~]# yum -y install mariadb-server
nginx配置
[root@web01 conf.d]# cat www.conf
server {
listen 80;
server_name www.wp.com;
access_log /var/log/nginx/www.wp.access.log main;
location / {
root /wp;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /wp;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
[root@web01 conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web01 conf.d]# systemctl restart nginx
php配置
# 修改php-fpm.d/www.conf 用户 用户组 监听方式
[root@web01 conf.d]# egrep "listen = |user = |group =" /etc/php-fpm.d/www.conf
user = nginx
group = nginx
listen = 127.0.0.1:9000
[root@web01 conf.d]# grep "listen =" /etc/php-fpm.d/www.conf
listen = 127.0.0.1:9000
# 测试php语法
[root@web01 conf.d]# php-fpm -t
[11-Dec-2024 14:28:27] NOTICE: configuration file /etc/php-fpm.conf test is successful
#重启服务
[root@web01 conf.d]# systemctl restart php-fpm.service
mysql配置
[root@web01 ~]# mysqladmin password '123456'
创建代码目录并修改权限
[root@web01 ~]# mkdir /wp
[root@web01 ~]# chown nginx.nginx /wp
上传代码
wget https://wordpress.org/wordpress-5.5.tar.gz
tar zxvf wordpress-5.5.tar.gz -C /wp/
#创建数据库
[root@web02 conf.d]# mysql -u root -p123.bmk -e "create database wordpress;"
#访问测试
标签:web01,配置,lnmp,nginx,conf,linux,php,root,wp
From: https://www.cnblogs.com/sharecorner/p/18608809