实验环境: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 www.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/www/html/wordpress$fastcgi_script_name;
}
}
[root@conf.d localhost]#nginx -t
[root@conf.d localhost]#nginx -s reload

RS:172.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/www.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;

nginx做代理部署WordPress的更多相关文章

  1. nginx反向代理部署springboot项目报404无法加载静态资源

    问题:nginx反向代理部署springboot项目报404无法加载静态资源(css,js,jpg,png...) springboot默认启动端口为8080,如果需要通过域名(不加端口号)直接访问s ...

  2. 服务器使用nginx做代理,通过HttpServletRequest获取请求用户真实IP地址

    首先,在nginx配置中添加如下配置 server { listen ; server_name www.wenki.info; #要访问的域名 charset utf8; location / { ...

  3. nginx做代理安装docker

    1.环境 服务器IP 服务用途 是否能 联网 192.168.126.128 docker服务器(简称B服务器) 不能 192.168.126.130 nginx服务器(简称A服务器) 能 2.背景 ...

  4. Nginx反向代理部署指南

    一.反向代理 我们都知道,80端口是web服务的默认端口,其他主机访问web服务器也是默认和80端口进行web交互,而一台服务器也只有一个80端口,这是约定俗成的标准. 我们来看下面两个场景: 1.服 ...

  5. nginx反向代理部署vue项目(history模式)的方法

    前言: 根据标题我们要区分出两个信息 1. history 模式部署 ( vue的路由模式如果使用history,刷新会报404错误.) 2. Nginx 做反向代理 问题1思考: vue-route ...

  6. Nginx做代理

    0 查看日志 tail -f /var/log/nginx/access.log 1 Nginx代理配置语法 1.Nginx代理配置语法 Syntax: proxy_pass URL; Default ...

  7. asp.net Core 部署到CentOs7上,使用Nginx做代理

    一.CentOs7部署Nginx 1.准备工作 Nginx的安装依赖于以下三个包,意思就是在安装Nginx之前首先必须安装一下的三个包,注意安装顺序如下: 1 SSL功能需要openssl库,直接通过 ...

  8. 关于nginx做代理,uwsgi gunicorn等服务器做后端时

    (1) 响应数据过大 被截断的问题 通常看buffers参数的设置(缓冲从后端服务器的应答) uwsgi的参数是 uwsgi_buffers 4 128k gunicorn 设置代理参数 proxy_ ...

  9. Nginx反向代理部署NodeJS项目

    在nginx配置文件种的http节点下: server { listen 8005; server_name localhost; location /{ proxy_set_header X_Rea ...

随机推荐

  1. 初步jmeter安装与使用

    前言,最近公司做了面向全国用户的教育平台,由于测试人员以功能测试为主,于是接口代码压测就被开发揽了,这就开始倒腾jmeter了,其实我想对于java,我更愿意用Python的工具,毕竟我爬虫时用的Py ...

  2. Javaweb基础--->监听器listener(转发)

    JavaWeb中的监听器 1.基本概念 JavaWeb中的监听器是Servlet规范中定义的一种特殊类,它用于监听web应用程序中的ServletContext, HttpSession和 Servl ...

  3. Python赋值原理:Python无变量,万物皆对象

    有几个和以前的常见语言,比如c语言不同 改变变量数据不覆盖原来的 name = '苍老师' print(id(name)) name = '志玲' print(id(name)) 运行结果 73955 ...

  4. ubuntu防火墙

    开启防火墙 sudo ufw enable 关闭防火墙 sudo ufw disable 查看防火墙状态 sudo utw status

  5. 如何让Jackson JSON生成的数据包含的中文以unicode方式编码

    我们都知道,Jackson JSON以高速.方便和灵活著称.之前的文章中介绍过使用注解的形式来规定如何将一个对象序列化成JSON的方法,以及如何将一个JSON数据反序列化到一个对象上.但是美中不足的一 ...

  6. lnmp 一键安装配置

    l系统需求: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian/Deepin Server/Aliyun/Amazon/Mint Linux发行版 需要5GB以上硬盘 ...

  7. (转)edm注意事项

    格式编码 1.页面宽度请设定在600到800px以内,长度1024px以内. 2.HTML编码请使用utf-8. 3.HTML代码在15KB以内.(各个邮箱的收件标准不一样,如果超出15KB您的邮件很 ...

  8. java: jsp:param中文乱码

    java: jsp:param中文乱码 假如a.jsp/b.jsp文件中 a.jsp代码: 需要加入:request.setCharacterEncoding("UTF-8")  ...

  9. python3 字符串属性(一)

    python3 字符串属性 >>> a='hello world' >>> dir(a) ['__add__', '__class__', '__contains_ ...

  10. SpringBoot_04_热部署

    二.参考资料 1.Spring Boot 系列(六)web开发-Spring Boot 热部署