当前位置: 首页 > news >正文

前后端联调需要改ip联调多个后端,用nginx代理

前后端联调需要改ip联调多个后端

Nginx


#user  nobody;
worker_processes  1;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  1024;
}http {include       mime.types;default_type  application/octet-stream;#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#gzip  on;server {listen       9095;server_name  localhost;root   html;index  index.html index.htm;#charset koi8-r;#access_log  logs/host.access.log  main;#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   html;}location / {proxy_pass http://192.168.2.226:9093;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;}# 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;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {#    listen       8000;#    listen       somename:8080;#    server_name  somename  alias  another.alias;#    location / {#        root   html;#        index  index.html index.htm;#    }#}# HTTPS server##server {#    listen       443 ssl;#    server_name  localhost;#    ssl_certificate      cert.pem;#    ssl_certificate_key  cert.key;#    ssl_session_cache    shared:SSL:1m;#    ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;#    location / {#        root   html;#        index  index.html index.htm;#    }#}}```java
在这里插入代码片
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/cc9e0b34925647fa90d6dc898aa25416.png)
## 主要nginx代码```javaroot   html;index  index.html index.htm;location / {proxy_pass http://192.168.2.226:9093;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;}

前端配置
在这里插入图片描述
在这里插入图片描述


http://www.mrgr.cn/news/55181.html

相关文章:

  • ford面试准备
  • 携程线下一面,面试内容:
  • docker 文件目录迁移
  • 求刚体移动后的转换矩阵
  • Python 数据类型,是否可变、可哈希
  • 空间单细胞转录组cell2location分析流程学习
  • QT5升级到QT6后遇到的问题
  • Bitmap 和 布隆过滤器傻傻分不清?你这不应该啊
  • 聚焦IOC容器刷新环节postProcessBeanFactory(BeanFactory后置处理)专项
  • SVN 小乌龟 下载地址
  • Git 基本配置
  • nodejs基础(2)
  • 同步和异步路由
  • 【网络安全的神秘世界】Python 3.7安装教程
  • C++实现简易JSON解析与转储
  • 电磁兼容(EMC):趋肤效应在PCB设计中的应用详解
  • DataGrip导出MySql提示无权限errno 13 - Permission denied问题
  • 使用Milvus和Llama-agents构建更强大的Agent系统
  • Mybatis扩展
  • Dockerfile 中,把多个 RUN 合并在一起,能减少镜像尺寸吗?
  • 特斯拉自动驾驶出租车计划变成泡影?联想与Meta合作,推出面向PC的个人AI智能体AI Now|AI日报
  • 学生学籍管理系统设计与实现(源码+定制+开发)
  • Varchar(255)可以存255个汉字
  • 为什么互动投影墙在儿童展馆中如此受欢迎?创新互动是关键吗?
  • 【AIGC】ChatGPT提示词Prompt高效编写模式:Self-ask Prompt、ReACT与Reflexion
  • 加速应用开发:低代码平台云SaaS和源码交付模式如何选