nginx 配置转发到其他多台服务器
来源:互联网 发布:永琪干了知画 编辑:程序博客网 时间:2024/06/08 03:08
修改nginx.conf文件,在http下添加
upstream site { server 127.0.0.1:9999; server 127.0.0.1:8888; server 127.0.0.1:7779; server 127.0.0.1:7777;}
然后在 location中添加
proxy_pass http://site;
这里的site 跟 upstream后面的名字对应。
全部的信息如下:
#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; upstream site { server 127.0.0.1:9999; server 127.0.0.1:8888; server 127.0.0.1:7779; server 127.0.0.1:7777; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html; proxy_pass http://site; } #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; } # 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; # } #}}
阅读全文
0 0
- nginx 配置转发到其他多台服务器
- 一台nginx服务器多域名配置
- 一台nginx服务器多域名配置
- 一台nginx服务器多域名配置
- nginx 配置转发到tomcat
- 【nginx】一台nginx服务器多域名配置
- nginx安装配置启动,把前端的请求一部分转发到本地,ajax请求转发到服务器。
- Nginx和Tomcat一台服务器配置多个域名
- nginx关于配置多个虚拟主机和向后台转发的配置文件
- CentOS7.3+Nginx+多个Tomcat服务器转发配置搭建笔记
- 同一服务器下配置多域名,去掉Tomcat端口号,Nginx反向代理做转发
- 配置多台Tomcat服务器
- 服务器配置多台tomcat
- nginx配置,请求502转发到其它机器处理
- Nginx转发代理配置
- nginx 配置端口转发
- nginx配置转发
- nginx TCP转发配置
- 前言
- 逻辑英语-写作
- django+Python的项目中出现 "detail": "CSRF Failed: CSRF cookie not set."
- Gensim官方教程翻译——快速入门
- 提高深度学习性能的四种方式
- nginx 配置转发到其他多台服务器
- 2017年工作总结
- Linux应用编程
- TensorFlow基本操作(二)
- jdk1.8对HashMap的优化
- Hadoop的调度器总结
- 剑指offer — 滑动窗口的最大值
- 树的层序遍历(c语言版)
- zipkin