`

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;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
proxy_connect_timeout 2s;  
client_max_body_size 100M;
      
    upstream tomcat_pool {
        server localhost:8080;  
        server 10.10.1.223:80;
	ip_hash ; 
    }  
    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen       80;
        server_name  www.gzzyly.gov.cn;

        charset utf-8;

        #access_log  logs/host.access.log  main;
 
  if ($request_method !~ ^(GET|HEAD|POST)$ ) {
    return 444;
  }
  if ($host !~ ^(gzzyly.gov.cn|www.gzzyly.gov.cn|localhost|10.10.1.252)$ ) {
    set $host_without_www $1;
    rewrite ^(.*)$ http://$host_without_www$1permanent;
  }
	
        location / {
            proxy_pass http://tomcat_pool/;  
            proxy_set_header Host $host;  
            proxy_set_header X-Real-IP $remote_addr;  
            proxy_set_header REMOTE-HOST $remote_addr;  
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        }
	location ~ /validatecode.png$ {
            proxy_pass http://tomcat_pool;
        }
	location ~ /dwr/* {
            proxy_pass http://tomcat_pool;
        }
        #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;
        }
        location ~.*\.(js|css|gif|jpg|jpeg|png|ico)$  {
            root   /usr/local/resin-pro-4.0.40/webapps/ROOT/;
        }
        #location ~ \.jgp {
        #    root   /usr/local/resin-pro-4.0.40/webapps/ROOT/;
        #}
        # 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;
    #    }
    #}

}

 

分享到:
评论

相关推荐

    Nginx完整配置说明

    Nginx完整配置说明,入门级的,高级指令不在这,得自己买书看,别下错了,基本部署用的

    nginx完整配置手册

    nginx完整配置手册

    51CTO下载-nginx完整配置手册_v1.pdf

    51CTO下载-nginx完整配置手册_v1.pdf

    一个完整的nginx配置文件范例参考(含负载均衡)

    一个完整的nginx配置文件范例参考(含负载均衡)。学习,支持开源,支持nginx

    centos8 nginx1.20.1 与nginx配置文件

    nginx.conf nginx-1.20.1.tar.gz 这是关于centos8的nginx 和nginx 的配置https文件

    nginx配置多域名访问以及完整配置

    对nginx进行详细的访问数量,日志请求头配置,多域名分发,反向代理等配置,可以对手机访问进行判断重定向手机域名

    微服务nginx配置

    针对微服务的nginx完整配置。其中没有进行负载均衡的配置。只是对每个微服务代理的配置

    nginx 网页配置工具

    使用WebUI配置nginx的各项功能, 包括http协议转发, tcp协议转发, 反向代理, 负载均衡, ssl证书自动申请、续签、配置等, 最终生成nginx.conf文件并覆盖nginx的默认配置文件, 完成nginx的最终功能配置。 支持nginx...

    nginx https 配置

    里面 1.7.4 的nginx https 的配置 下载下来后 需要配置一下 nginx 的配置文件即可

    Nginx配置文件原始版本

    Nginx配置文件原始版本,这是刚下来的Nginx服务器最原始的版本内容,下载覆盖即可。

    nginx搭建配置详细说明

    3.1. Nginx的主配置文件概述 3.1.1. 认识配置文件 3.1.2. nginx的配置文件结构 3.1.3. nginx的全局配置 3.2. events配置 3.3. http的配置 3.4. nginx重要指令之location 4. nginx中的rewrite 4.1. 什么是...

    nginx完全配置手册

    nginx完全配置手册,集群配置 nginx完全配置手册,集群配置

    Windows平台,Nginx配置文件修改自动加载重启

    nginx配置文件修改保存,自动加载重启,并检查配置文件是否修改成功。 Windows下使用nginx,启动之后,再修改配置文件,无需命令重新加载,修改保存配置文件,实时更新nginx重启。

    Nginx服务器的安装与配置.pdf

    Nginx官网配置.pdf Nginx基本配置.pdf Nginx模块.pdf Nginx指南.pdf 第1章 Nginx简介.pdf 第2章 Nginx服务器的安装与配置.pdf 第3章 Nginx的基本配置与优化.pdf 第4章 Nginx与PHP(FastCGI)的安装、配置与优化.pdf 第...

    Web应用安全:Nginx日志配置实验.doc

    实验一:Nginx日志配置 实验目的 熟悉nginx并进行nginx日志配置 实验内容 查看配置文件信息 打开nginx主配置文件 配置nginx日志 实验环境 kali系统 实验步骤 1.查看nginx版本情况 在kali中输入“nginx -t”来查看...

    Nginx+keepalived核心配置文件

    Nginx核心配置文件Nginx.conf,keepalived核心配置文件keepalived.conf

    Web应用安全:Nginx权限配置.doc

    查看nginx配置文件 修改访问权限 重启nginx 查看结果 实验环境 kali系统 实验步骤 查看nginx配置文件 Nginx的主配置文件为“/etc/nginx/nginx.conf”,我们输入“vim /etc/nginx/nginx.conf”来查看配置文件的详细...

    nginx代理配置完整包

    最全配置,下載即用,nginx...当然你也可以使用nginx配置正向代理,本是介绍如何配置nginx的反向代理。 nginx反向代理的指令不需要新增额外的模块,默认自带proxy_pass指令,只需要修改配置文件就可以实现反向代理。

    zabbix5.0+nginx详细配置.docx

    zabbix5.0+nginx详细配置

    nginx配置+https

    nginx配置+https

Global site tag (gtag.js) - Google Analytics