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. Pop!_OS配置Python环境

    Pop!_OS配置Python环境 #0x0 安装vscode #0x1 配置vscode #0x0 安装vscode 见vscode安装 #0x1 配置vscode 安装Python插件 安装pyl ...

  2. 电商项目app开发

    购物app的开发 首先我们本次要写的是一个电商的项目,项目主要功能有登录.注册.商品展示.轮播图.加入购物车.购物车管理.支付管理.地址管理.个人信息的修改.商品的分类展示.微信支付等等.主要使用vu ...

  3. kubernetes系列(十五) - 集群调度

    1. 集群调度简介 2. 调度过程 2.1 调度过程概览 2.2 Predicate(预选) 2.3 Priorities(优选) 3. 调度的亲和性 3.1 node亲和性 3.1.1 node亲和 ...

  4. Ubuntu systemctl 查看管理系统启动项

    Ubuntu systemctl 查看系统启动项 列出所有启动项: sudo systemctl list-unit-files 会列出开启的和未开启的: 使用grep过滤一下开启的grep enab ...

  5. 安装archlinux

    arch安装步骤 archlinux官方安装wiki 1.分区and格式化分区      (分区用fdisk,格式化分区用mkfs) 2.挂载分区  (mount命令) 3.安装archlinux   ...

  6. python数据处理(六)之数据清洗:标准化和脚本化

    1.数据归一化和标准化 a. 归一化:对数据集进行计算,使数据都位于一个特定的范围\ b.标准化: c.删除离群值 2.数据存储 a.保存到SQLite数据库中 b.导出到简单的文件中csv 3.找到 ...

  7. Unity-内存

    editor 和runtime的内存管理分开的 unity检测不到native内存容量 如c++,lua 一个asset一个ab的问题在于 每个asset都有对应的文件头,并不划算 IL2CPP抛弃了 ...

  8. HLS的M3U8文件介绍

    HLS的M3U8文件介绍 HLS (HTTP Live Streaming)是Apple的动态码率自适应技术.主要用于PC和Apple终端的音视频服务. 相较于实时传输协议(RTP),HLS可以穿过任 ...

  9. ToText Basic 语法和 Crystal 语法

    本文转自http://www.softwelt.com/Know/KnowDetail-2236860.html ToText 和 CStr 是等价函数. 重载 ToText (x) ToText ( ...

  10. SpringMVC集成Mybatis

    1.pom.xml中添加引入架包 <dependency> <groupId>mysql</groupId> <artifactId>mysql-con ...