nginx多个server的配置,同一端口

#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;
upstream www.app.com { //集群配置
ip_hash;
server 192.168.9.14:80 weight=10;
server 192.168.9.15:80 weight=10;
}
#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 80;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
#root html;
#index index.html index.htm;
proxy_pass http://www.app.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} #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;
#}
} # 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;
# }
#} }

nginx多个server的配置,同一端口的更多相关文章

  1. Nginx 使用(server参数配置)

    文件地址nginx/conf/Nginx.conf 文件地址;nginx/conf/Nginx.conf [java] view plain copy server {# 服务名及配置,一个服务下可以 ...

  2. 配置Windows 2008 R2 防火墙允许远程访问SQL Server 2008 R2 更改端口 连接字符串 IP+逗号+端口号

      1.先修改 sql server 2008R2的端口号吧,1433经常成为别人入侵的端口,在sql server 配置管理器 -->sql server 网络配置-->MSSQLSER ...

  3. nginx配置8081端口异常

    1.为nginx配置8081端口,结果nginx报错. (nginx配置8081端口监听,通过查看日志,出现nginx: [emerg] bind() to 0.0.0.0:8081 failed ( ...

  4. nginx安装及负载均衡配置

    Nginx (“engine x”) 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 Igor Sysoev 为俄罗斯访问量第二 ...

  5. Nginx 简单的负载均衡配置示例(转载)

    原文地址:Nginx 简单的负载均衡配置示例(转载) 作者:水中游于 www.s135.com 和 blog.s135.com 域名均指向 Nginx 所在的服务器IP. 用户访问http://www ...

  6. Nginx系列4之基础配置

    preface 公司跑得大多数是LNMP平台,所以借此机会多多了解下Nginx.下面主要说说Nginx下面几点: 防盗链 日志切割 负载均衡 虚拟主机 location匹配解释 substatus状态 ...

  7. LNMP(linux+nginx+mysql+php)服务器环境配置

    一.简介 Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为 “engine X”, 是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/SMTP 代理服 ...

  8. Nginx反向代理讲解和配置

    首先来介绍下Nginx的反向代理.代理服务器一般分为正向代理(通常直接称为代理服务器)和反向代理. 画个图我们就好理解了. 正向代理:可以想象成是路由器,我们要通过它来上网的那种.(可以说是客户端的代 ...

  9. Nginx 简单的负载均衡配置示例

    http://www.cnblogs.com/xiaogangqq123/archive/2011/03/02/1969006.html 在此记录下Nginx服务器nginx.conf的配置文件说明, ...

随机推荐

  1. scrapy 基础组件专题(四):信号运用

    一.scrapy信号使用的简单实例 import scrapy from scrapy import signals from ccidcom.items import CcidcomItem cla ...

  2. java 基本语法(五) 流程控制(二) 循环结构

    1.循环结构的四要素① 初始化条件② 循环条件 --->是boolean类型③ 循环体④ 迭代条件说明:通常情况下,循环结束都是因为②中循环条件返回false了. 2.三种循环结构:2.1 fo ...

  3. Configurate vim tool

    vim tool is a commom editor, for the sake of improving effeicient, it is necessary to configurate vi ...

  4. web CSS3 实现3D动态翻牌效果

    使用纯CSS3 实现翻牌效果  需要注意要给子盒子使用绝对定位,这样两个盒子可以完全重合在一起,需要给父盒子一个 transform-style: preserve-3d;让子盒子翻转时保持3D效果, ...

  5. 不会吧,有人用了两年Spring, 居然不知道包扫描是怎么实现的

    全栈的自我修养: 0004 Java 包扫描实现和应用(File篇) I may not be able to change the past, but I can learn from it. 我也 ...

  6. Pycharm无法安装第三方库,错误代码Non-zero exit code (1) 的解决方案之pip升级

    软件测试,B站爱码小哥邀你同行! 进入主题 问题场景:在pycharm进行安装某些库,install失败,提示需要升级pip ,报错界面问题如下错误代码Non-zero exit code 大致意思是 ...

  7. 第八章:理解Window和WindowManager

    Window表示一个窗口的概念. Window是一个抽象类,它的具体实现是PhoneWindow, WindowManager是外界访问Window的入口,Window的具体实现位于WindowMan ...

  8. Vue脚手架的搭建和路由配置

  9. 2万字长文包教包会 JVM 内存结构 保姆级学习笔记

    写这篇的主要原因呢,就是为了能在简历上写个"熟悉JVM底层结构",另一个原因就是能让读我文章的大家也写上这句话,真是个助人为乐的帅小伙....嗯,不单单只是面向面试学习哈,更重要的 ...

  10. IDEA 2020.1.2安装破解激活 idea 2020.1.3下载 安装 一键破解

    IDEA 2020.1.2 idea 2020.1.3下载 安装 破解 本项目只做个人学习研究之用,不得用于商业用途!若资金允许,请点击链接购买正版,谢谢合作!学生凭学生证可免费申请正版授权!创业公司 ...