Windows环境下绿色版nginx 1.30使用

1.下载

下载地址:https://nginx.org/en/download.html

2.解压

将下载的安装包解压到:E盘下

3.使用

复制代码
主要差异点:
 upstream oa_cluster{
            # sticky;
            sticky cookie example;
            server 127.0.0.1:80 max_fails=300 fail_timeout=30s;
        }

nginx.conf

复制代码
worker_processes auto;
worker_rlimit_nofile 20960;
error_log  logs/error.log  error;
events {
    worker_connections  4096;
    multi_accept on;
    accept_mutex on;
    accept_mutex_delay 500ms;
}
http {
        server_tokens off;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        access_log off;
        include       mime.types;
        default_type  application/octet-stream;
        keepalive_timeout  300;
        client_max_body_size 10240M;

        gzip on;
        gzip_min_length 1k;
        gzip_buffers 4 16k;
        gzip_comp_level 3;
        gzip_types text/xml text/plain text/css text/javascript application/x-javascript application/javascript application/xml;
        gzip_disable "MSIE [1-6]\.";
		
        upstream oa_cluster{
            # sticky;
            # 主要差异点
            sticky cookie example;
            server 127.0.0.1:80 max_fails=300 fail_timeout=30s;
        }

		# OA-http
        server {
            listen 8080;
            server_name localhost;
            charset utf-8;

            location / {
                proxy_pass http://oa_cluster;
                proxy_set_header Host $http_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;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_redirect http:// $scheme://;
                proxy_connect_timeout 300;
                proxy_read_timeout 300;
                proxy_send_timeout 300;
            }
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
		#OA-https
        server {
            listen 8443 ssl;
            server_name localhost;
            ssl_certificate cert.crt;
            ssl_certificate_key  cert.key;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            charset utf-8;

            location / {
                proxy_pass http://oa_cluster;
                proxy_set_header Host $http_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;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_redirect http:// $scheme://;
                proxy_connect_timeout 300;
                proxy_read_timeout 300;
                proxy_send_timeout 300;
            }
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
    }
相关推荐
赵文宇(温玉)2 小时前
Docker离线安装
运维·docker·容器
进击的荆棘2 小时前
Linux网络——传输层协议UDP
linux·运维·服务器·网络·udp
Android系统攻城狮3 小时前
FFmpeg深度解析之av_bsf_get_by_name:如何查找码流过滤器?(七十九)
linux·运维·ffmpeg·音视频进阶·ffmpeg音视频
Decay__4 小时前
PostgreSQL 监控体系构建 —— postgres_exporter + Prometheus + Grafana 全栈实战
运维·数据库·sql·postgresql
Decay__6 小时前
PostgreSQL 告警与自动化运维 —— 告警分级收敛、Webhook、定时巡检、脚本库
运维·数据库·sql·postgresql
程序员agions7 小时前
Docker Compose 生产环境配置记录
运维·docker·容器
郝学胜-神的一滴7 小时前
Effective Python 条款45:巧用属性注解平滑升级类属性
运维·开发语言·数据库·python·网络协议·numpy
Mikko77 小时前
Redis 主从切换期间可用吗?6.2 实测哨兵切换:应用不可写 33 秒,主从连不上、数据不一致,以及设了 ACL 后哨兵不切换
java·运维·redis·后端
进击的荆棘9 小时前
Linux网络——应用层协议HTTP
linux·运维·服务器·网络·http
迪康软件zz9 小时前
敏感文件判定引擎:从单词命中到加权打分
运维·安全·自动化运维