您现在的位置是:首页 > 教程 > WordPress教程WordPress教程

nginx做代理部署WordPress的方法示例

之瑶2025-02-19 19:18:59WordPress教程已有8人查阅

导读实验环境:CentOS7服务器172.16.252.142做Nginx代理服务器:[root@conf.d localhost]#iptables -F[root@conf.d localhost]#setenforce 0[root@conf.d localhost]#yum -y in

实验环境:CentOS7
服务器172.16.252.142做Nginx代理服务器:
[root@conf.d localhost]#iptables -F
[root@conf.d localhost]#setenforce 0
[root@conf.d localhost]#yum -y install nginx
[root@conf.d localhost]#cd /etc/nginx/conf.d/
[root@conf.d localhost]#vim default.conf
#静态资源和动态资源全部用一台服务器172.16.254.47,用不同的端口;
server {
listen 80;
server_name.mylinux.io;
location ~* \.(html|js|css|jpg|jpeg|png|gif)$ {
#location / {
proxy_pass http://172.16.254.47:80;
}
location ~* \.php$ {
fastcgi_pass 172.16.254.47:9000;
fastcgi_index index.php;
include fastcgi_params;
#向后端php-fpm服务器传递脚本的方式:是在fastcgi_param文件中,将变量SCRIPT_NAME向后传递,/data/apps是php-fpm的document路径
fastcgi_param SCRIPT_FILENAME /var/ /html/wordpress$fastcgi_script_name;
}
}
[root@conf.d localhost]#nginx -t
[root@conf.d localhost]#nginx -s reload
RS172.16.254.47
[root@html localhost]#yum -y install mariadb-server php-mysql
[root@html localhost]#chown -R nginx:nginx wordpress/
[root@html localhost]#vim /etc/php-fpm.d/ .conf
listen = 172.16.254.47:9000 #监听本地地址
listen.allowed_clients = 172.16.252.142 #Nginx代理服务器的地址
[root@html localhost]#mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 286
Server version: 5.5.52-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> GRANT ALL ON wp.* TO wp@'172.16.254.47' IDENTIFIED BY '123456';
MariaDB [(none)]> CREATE DATABASE wp;
MariaDB [(none)]> FLUSH PRIVILEGES;

本文标签:

很赞哦! (0)

暂无内容
暂无内容
暂无内容
暂无内容
留言与评论 (共有 0 条评论)
昵称:
匿名发表 登录账号
         
验证码: