`
lijiejava
  • 浏览: 264308 次
  • 性别: Icon_minigender_1
  • 来自: 南通
社区版块
存档分类
最新评论

Nginx

 
阅读更多
Nginx

下载nginx,安装完成后查看其目录结构:
client_body_temp	
fastcgi_temp		
logs			
sbin			     // 启动 关闭目录
uwsgi_temp
conf			     // 配置文件所在文件夹
html		          // index.html   默认显示页面	
proxy_temp		
scgi_temp

sbin目录下  启动: sudo ./nginx     关闭: sudo ./nginx -s stop


配置文件:


#user  nobody;
worker_processes  auto;
worker_rlimit_nofile 100000;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  100000;
    multi_accept on;
    use epoll;
}

http {

    // 配置集群
    upstream tomcat {
           server 192.168.31.10:8080 weight=10;
           server 192.168.31.11:8081 weight=10;
           server 192.168.31.12:8082 weight=10;
    }

    upstream touch{
       server 127.0.0.1:32222; 
    }

    include       mime.types;
    include /opt/nginx-1.8.0/conf/proxy.conf;
    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;
    server_tokens off;
    sendfile        on;
    tcp_nopush     on;
    access_log off;
    #keepalive_timeout  0;
    keepalive_timeout  10;
    client_header_timeout 10;
    client_body_timeout 10;
    reset_timedout_connection on;
    send_timeout 10;
    limit_conn_zone $binary_remote_addr zone=addr:5m;
    limit_conn addr 60000;
    charset UTF-8;
    
    gzip on;
    # gzip_static on;
    gzip_disable "msie6";
    gzip_proxied any;
    gzip_min_length 1000;
    gzip_comp_level 4;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    # cache informations about file descriptors, frequently accessed files
    # can boost performance, but you need to test those values
    open_file_cache max=100000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;
    include /opt/nginx-1.8.0/conf.d/*.conf;
    include /opt/nginx-1.8.0/sites-enabled/*;

    server {
        listen       80;
        server_name  fruit.tunnel.qydev.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

      
        location /admin {
#            root   html;
 #           index  index.html index.htm;
              proxy_pass http://tomcat/admin;     // 反向代理
        }

       location /hsh {
           proxy_pass http://touch/hsh;
       } 

      
      location /mobile {
        proxy_pass http://192.168.31.161:8080/mobile;
      }

      location /uicw {
          proxy_pass http://192.168.31.161:8080/uicw;
      }

      location /trans {
         proxy_pass http://192.168.31.161:8080/trans;
      }
       
     // 访问静态资源
      location /images {
            alias /data/fruit/images;     // 访问路径: /data/fruit/images
            expires 7d;
       }


        #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;
    #    }
    #}


   

   server {
        charset utf-8;
        listen       5555;
        server_name  localhost;
        #location ~* \.(eot|ttf|woff)$ {
        #  add_header Access-Control-Allow-Origin *;
        #}

        location /admin/store/maintenance {
           #add_header Access-Control-Allow-Origin *;
           #root   html;
           #index  index.html index.htm;
           proxy_pass http://tomcat1;
        }
        location /admin/store/enroll {
           #add_header Access-Control-Allow-Origin *;
           #root   html;
           #index  index.html index.htm;
           proxy_pass http://tomcat1;
        }
        location /admin/help/store/video {
           #add_header Access-Control-Allow-Origin *;
           proxy_pass http://tomcat1;
        }
        location /admin/help/agent/video {
           #add_header Access-Control-Allow-Origin *;
           proxy_pass http://tomcat1;
        }
        location /admin/agent/store/management{
           #root   html;
           #index  index.html index.htm;
           proxy_pass http://tomcat1;
        }

        location /admin/agentManager/store/management{
           #root   html;
           #index  index.html index.htm;
           proxy_pass http://tomcat1;
        }
        
        location /admin/agent/help/video{
           #root   html;
           #index  index.html index.htm;
          proxy_pass http://tomcat1;
        }

        location /admin/agentManager/help/video{
           #root   html;
           #index  index.html index.htm;
           proxy_pass http://tomcat1;
        }
		
        
        location /{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ https://192.168.31.161/$1  redirect;
        }
    }

    # HTTPS server
    #
    server {
        charset utf-8;
	access_log  logs/https_access.log;
        listen       443 ssl;
        server_name  localhost;
	      ssl                  on;
        ssl_certificate /opt/nginx-1.8.0/sslkey/server.crt;
        ssl_certificate_key /opt/nginx-1.8.0/sslkey/server.key;

        ssl_session_cache shared:SSL:10m;
	      ssl_session_timeout  10m;
	      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	      ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
	      ssl_prefer_server_ciphers on;
	      ssl_stapling on;
	      ssl_stapling_verify on;
	      ssl_trusted_certificate /opt/nginx-1.8.0/sslkey/startssl_trust_chain.crt;
	      resolver 61.177.7.1 8.8.8.8 8.8.4.4;
				
	      add_header Strict-Transport-Security "max-age=31536000";

        #location ~* \.(eot|ttf|woff)$ {
        #   add_header Access-Control-Allow-Origin *;
        #}

        location /admin/store/maintenance {
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
        }

        location /admin/store/enroll{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1  permanent;
        }

        location /admin/help/store/video{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1  permanent;
        }

        location /admin/agent/store/management{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1  permanent;
        }

        location /admin/agentManager/store/management{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1  permanent;
        }
        
        location /admin/agent/help/video{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1  permanent;
        }

        location /admin/agentManager/help/video{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1  permanent;
        }
        location /admin/help/agent/video{
           #root   html;
           #index  index.html index.htm;
           rewrite  ^/(.*)$ http://192.168.31.161:5555/$1  permanent;
        }
        location /admin {
           add_header Access-Control-Allow-Origin http://192.168.31.161:5555;
           #root   html;
           #index  index.html index.htm;
           proxy_pass http://tomcat1/admin;
        }
    }


    server {
        charset utf-8;
        listen       9090 ssl;
        server_name  localhost;

        ssi on;
        ssi_silent_errors on;
        ssi_types text/shtml;

        ssl_certificate      /opt/nginx-1.8.0/ca/server/server.crt;
        ssl_certificate_key  /opt/nginx-1.8.0/ca/server/server.key;
        ssl_client_certificate /opt/nginx-1.8.0/ca/private/ca.crt;

				ssl_session_cache shared:SSL:10m;
	      ssl_session_timeout  10m;
	      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	      ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
	      ssl_prefer_server_ciphers on;
	      ssl_stapling on;
	      ssl_stapling_verify on;
	      ssl_trusted_certificate /opt/nginx-1.8.0/sslkey/startssl_trust_chain.crt;
	      resolver 61.177.7.1 8.8.8.8 8.8.4.4;
				
	      add_header Strict-Transport-Security "max-age=31536000";

        location /mobile {
            #root   html;
            #index  index.html index.htm;
            proxy_pass http://tomcat1/mobile;
        }
        location /storemobile {
            #root   html;
            #index  index.html index.htm;
            proxy_pass http://tomcat1/storemobile;
        }
        location /agentmobile {
            #root   html;
            #index  index.html index.htm;
            proxy_pass http://tomcat1/agentmobile;
        }
    }




     server {
        listen       7777;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location /mobile/html {

            proxy_pass http://tomcat1/mobile/html;
        }

        #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;
        #}
    }

}

 



分享到:
评论

相关推荐

    nginx版本升级步骤

    **Nginx版本升级步骤详解** 在Web服务器领域,Nginx以其高性能、低内存消耗以及高并发处理能力而备受青睐。随着新版本的发布,可能会包含性能优化、安全修复和新特性,因此定期更新Nginx版本是必要的。本文将详细...

    arm 架构 docker运行nginx镜像包

    arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构...

    nginx-1.24.0.tar

    Nginx 1.24.0 是 Nginx 开源项目发布的一个重要更新版本,该版本在性能优化、功能增强以及安全性提升方面带来了诸多改进。当您下载 Nginx 1.24.0 的压缩包时,您将获得一个包含 Nginx 源代码的压缩文件,通常命名为 ...

    nginx1.16镜像包

    nginx1.16镜像包 使用docker load -i xx.tar 拉取镜像 使用docker images 查看是否成功。 运行容器 docker run --name nginx-test -p 8080:80 -d nginx 参数说明: --name nginx-test:容器名称。 -p 8080:80: ...

    nginx 离线安装依赖nginx 离线安装依赖

    在某些情况下,比如没有外网访问权限的内网环境,或者出于安全和稳定性考虑,用户可能需要在没有网络连接的情况下安装Nginx。离线安装Nginx意味着不能通过包管理器直接从互联网下载安装包和依赖,因此需要预先准备好...

    centos8 nginx1.20.1 与nginx配置文件

    现在,我们可以下载Nginx的源代码包`nginx-1.20.1.tar.gz`。你可以通过wget或者浏览器将文件下载到本地,然后解压: ```bash wget http://nginx.org/download/nginx-1.20.1.tar.gz tar -zxvf nginx-1.20.1.tar.gz cd...

    nginx依赖包资源下载

    在探讨nginx依赖包资源下载的背景之下,我们首先要了解nginx是什么。Nginx是一款轻量级的Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。由于其高性能、稳定性、丰富的功能集以及简单的配置方式,...

    Nginx-1.23.2.zip

    Nginx是一个高性能的Web服务器和反向代理服务器,它以其高效的并发处理能力、低内存占用和稳定性而闻名。在1.23.2版本中,Nginx继续提供了优化和改进,以满足不断变化的互联网需求。这个版本可能是对之前版本的bug...

    nginx1.26.2版本docker镜像

    版本 1.26.2 是 Nginx 在 2023 年发布的新版本,它通常包含对各种协议的改进、性能优化以及安全问题的修复。 Docker 是一个开源的应用容器引擎,可以让开发者打包他们的应用以及应用的依赖包到一个可移植的容器中,...

    nginx arm64版本nginx-linux-arrch64.zip

    这个名为"nginx-linux-arm64.zip"的压缩包提供的是专为ARM64架构(也称为AArch64)编译的Nginx版本,适用于基于Linux操作系统的64位ARM处理器设备,如树莓派、某些云服务器或嵌入式系统。无需繁琐的编译过程,只需...

    nginx1.18镜像包

    nginx1.18镜像包 使用docker load -i xx.tar 拉取镜像 使用docker images 查看是否成功。 运行容器 docker run --name nginx-test -p 8080:80 -d nginx 参数说明: --name nginx-test:容器名称。 -p 8080:80: ...

    nginx1.16+nginx-upstream-check-module-master+nginx-upload-module

    这里我们关注的是一个包含特定模块的Nginx配置:`nginx1.16`,`nginx-upstream-check-module-master` 和 `nginx-upload-module`。这三个组件将帮助我们增强Nginx在处理后端服务健康检查、文件上传等方面的功能。 ...

    nginx-1.27.1 for windows

    由俄罗斯人Igor Sysoev所开发,其特点是占有内存少,并发能力强,事实上Nginx的并发能力确实在同类型的网页服务器中表现较好。Nginx已经在多数安装了PHP的应用中代替了Apache服务器,而由于其易于配置,轻量级,性能...

    nginx替代方案,nginx代替apache与jboss

    ### Nginx 作为 Apache 和 JBoss 的替代方案 #### 背景介绍 随着互联网技术的不断发展,网站流量的增长对服务器性能提出了更高要求。Apache 和 JBoss 是两种广泛使用的 Web 服务器和应用服务器,但在高并发场景下,...

    nginx-1.13.3,nginx1.13.3不存在信息泄漏漏洞安全稳定nginx版本

    **Nginx 1.13.3 版本详解** Nginx 是一款高性能的 HTTP 和反向代理服务器,广泛应用于网站托管、负载均衡以及应用程序交付等领域。它以其高效、稳定和轻量级的特性著称,尤其在处理静态内容和高并发请求时表现优秀...

    nginx arm版本 docker镜像

    在2011年,Nginx的市场份额已经超越了Apache,成为世界上使用最多的Web服务器软件之一。Nginx以其高性能、稳定性、丰富的功能集、简单的配置文件和低资源消耗而闻名。Nginx的模块化架构设计使其具有高度的可扩展性,...

    nginx-upstream-jvm-route 和 nginx 对应版本,亲测可用

    此资源有两个文件,含 nginx-upstream-jvm-route 和 nginx 对应版本,都是tar.gz文件。 安装方法网上很多就不写了,亲测可用。 不用担心版本不匹配造成安装失败,再浪费积分去到处下载尝试的烦恼。 此资源有两个文件...

    Linux离线安装nginx安装包

    在Linux系统中,离线安装Nginx是一个常见的需求,特别是在没有互联网连接或者网络环境受限的服务器上。本文将详细讲解如何通过离线方式在Linux上安装Nginx,同时也会涉及Nginx依赖的软件如openssl和gcc的安装过程。 ...

    无标题nginx1.26.2的docker镜像文件

    无标题nginx1.26.2的docker镜像文件实际上是一种以Docker容器形式封装的Nginx服务器软件。Docker是一个开源的应用容器引擎,允许开发者打包应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,...

    nginx配置tcp转发(nginx通过白名单访问)

    要配置Nginx进行TCP代理转发,我们需要创建一个新的Nginx配置文件,通常放在`/etc/nginx/conf.d/`目录下,例如命名为`tcp_proxy.conf`。在该文件中,我们需要使用`stream`模块来处理TCP流量。下面是一个基础的配置...

Global site tag (gtag.js) - Google Analytics