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;

worker_rlimit_nofile 65535;
events {
    worker_connections  65535;
}

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       80;
        #server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

#location / {
        #   root   html;
         #  index  index.html index.htm;
        #}

#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;
    #    }
    #}
 upstream tomcat8091 {
     server 172.16.0.130:8091;
  server 172.16.0.131:8091;
  }
  upstream tomcat8092 {
     server 172.16.0.130:8092;
  server 172.16.0.131:8092;
  }
 server { 
       listen  8091; 
       location / { 
           root   html; 
            index  index.html index.htm; 
            proxy_pass http://tomcat8091;
   proxy_set_header  X-Real-IP  $remote_addr; 
            client_max_body_size  100m;

}  
 
    } 
 server { 
       listen      8092; 
       location / { 
           root   html; 
            index  index.html index.htm; 
            proxy_pass http://tomcat8092;
   proxy_set_header  X-Real-IP  $remote_addr; 
           client_max_body_size  100m;


  location ~ \.(jpg|png|gif)$ {
           proxy_pass  http://172.16.0.130:8092;   #图片指定一个地址中
        } 
 
    }

}

时间: 2024-08-13 03:31:58

nginx集群中图片指定一个地址中的相关文章

MySQL集群架构以及本人配置过程中出现的问题及解决办法

首先说下MySQL的优缺点 优点 解决单点故障 自动实现数据冗余 缺点就是维护起来太麻烦. 集群的条件就是所有的机器上都要安装MySQL的集群软件,我安装的是MySQL-Cluster-gpl-7.3.5-1.el6.x86_64.rpm的rpm包,不是源码包安装.如果系统里面安装了mysql-server等数据库服务软件的要自行写在掉即可. MySQL集群中有三种角色,下面是三种角色以及其的作用 角色 数据节点:ndbd节点 存储在表里的数据(表中的记录) SQL节点:不存储数据,供用户访问和

Tomcat学习总结(8)——Tomcat+Nginx集群解决均衡负载及生产环境热部署

近日,为解决生产环境热部署问题,决定在服务器中增加一个tomcat组成集群,利用集群解决热部署问题. 这样既能解决高并发瓶颈问题,又能解决热部署(不影响用户使用的情况下平滑更新生产服务器)问题. 因为项目是前后端分离的,所以本以为成本很低,没想到遇到了一系列的坑,解决了2天才搞定,发现了很多不是集群而是项目本身的问题. 我是同一个服务器下配置tomcat和nginx等,本文主要面向有一定基础的读者,基本配置就不在本文累述了(基础问题可以留言或者发邮件). 0x0_1 服务器环境 服务器: Cen

nginx 集群

Nginx是什么? Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器.一直纳闷这个X是怎么来的在网上查了查原来X代表很牛逼的样子,Nginx就是代表一个非常牛逼的引擎服务器系统,在很多年以前记得都是用的apache来作为分流以及负载均衡的作用,在过了几年中一个俄罗斯人又开发了一个性能更高的服务器来处理客户端向浏览器发出的各种请求,它从技术角度解决了大数量高并发的用户量访问,官网上面写的并发数量可以达

Redis+Tomcat+Nginx集群实现Session共享,Tomcat Session共享

Redis+Tomcat+Nginx集群实现Session共享,Tomcat Session共享 ============================= 蕃薯耀 2017年11月27日 http://www.cnblogs.com/fanshuyao/ 代码美化版或附件下载见:http://fanshuyao.iteye.com/blog/2400975 一.Session共享使用tomcat-cluster-redis-session-manager插件实现 插件地址见:https://g

Nginx集群之基于Redis的WebApi身份验证

目录 1       大概思路... 1 2       Nginx集群之基于Redis的WebApi身份验证... 1 3       Redis数据库... 2 4       Visualbox虚拟机ubuntu下的redis部署... 3 5       编写.NET WebApi的OnAuthorization身份验证... 6 6       编写.NET WebApi的ActionFilterAttribute令牌验证... 8 7       编写.NET WebApi的服务端.

用Nginx+Telegraf+Influxb+Grafana构建高逼格Nginx集群监控系统

日常生产环境搭建了Nginx集群后,就需要继续深入研究的就是日常Nginx监控. Nginx如何监控?相信百度就可以找到:nginx-status 通过Nginx-status,实时获取到Nginx监控数据后,如何和现有监控系统集成?一个很好的解决方案: Nginx+Telegraf+Influxdb+Grafana 即通过Telegraf监控插件定时收集Nginx的监控状态,存储到时序数据库Influxdb中,然后通过Grafana展现即可. 一.Nginx启用nginx-status功能 源

nginx集群配置

作者:夕阳小子 时间:2017-5-1 优化思路: Nginx层面: 解决: nginx.conf 下面: work_connection 加大 worker_connections 10240; Worker_rlimit_nofiles 10000; Keepalive_timeout 0; 系统层面 1: 内核层面,加大连接数,并加快tcp回收 2: mysql层面,增大连接数 3: php层面,用长连接,节省连接数 4: 用memcached缓存,减轻mysql负担 A服务器:nginx

部署tomcat负载均衡集群,实现节点之间内存中的Session共享。

在实验之前先来了解下tomcat会话管理器(Manager) Manger对象用于实现HTTP会话管理的功能,介绍下几种常见的: 1.StandardManager(标准会话管理器) 用于非集群环境中对单个处于运行状态的Tomcat实例会话进行管理.当Tomcat关闭时,这些会话相关的数据会被写入磁盘上的一个名叫SESSION.ser的文件,并在Tomcat下次启动时读取此文件.如果tomcat正常关闭会话不会丢失,如果是tomcat主机崩溃或者进程崩溃那会话是一定会丢失的. 2.Persist

Tomcat+Nginx集群

# Tomcat+Nginx集群## Tomcat* 修改/etc/profile中的环境变量```export JAVA_HOME=/usr/java/jdk1.7.0_80export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME$/lib/tools.jarexport MAVEN_HOME=/home/developer/apache-maven-3.0.5export PATH=$PATH: