分享
查看: 481|回复: 0

[分享] Linux上设置Nginx内容

[复制链接]

Linux上设置Nginx内容

发表于 2023-8-18 17:20:17 来自 分享 阅读模式 倒序浏览
zzv_icon481 zzr_icon0 查看全部
本帖最后由 tangan 于 2023-8-18 17:24 编辑

nginx.conf 文件配置如下:
整体结构图

Linux上设置Nginx内容

nginx.conf 在Linux下具体配置内容:
worker_processes  4;
user root;
error_log  logs/error.log;
pid        logs/nginx.pid;

events {
        use epoll;
        worker_connections  1024;
}

http {
        include       mime.types;
        default_type  application/octet-stream;

        sendfile        on;

        keepalive_timeout  65;
        underscores_in_headers  on;
        port_in_redirect off;
   
        gzip on;
        gzip_min_length 10k;
        gzip_buffers 4 16k;
        gzip_comp_level 8;
        gzip_proxied any;
        gzip_types text/plain application/x-javascript text/css application/xml application/javascript text/javascript application/x-httpd-php image/jpeg image/gif image/png image/svg image/x-ms-bmp application/octet-stream application/json;
        gzip_vary off;
        gzip_disable "MSIE [1-6]\.";

        server {
                client_max_body_size 20G;
                listen       8088;
                add_header Access-Control-Allow-Origin '*' always;
                add_header Access-Control-Allow-Methods 'GET, PUT, POST, DELETE, OPTIONS';
                add_header Access-Control-Allow-Headers 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
                location /thing/auth {
                        alias /uinnova/thingjsx-front/auth;
                }
                location /thing/rsm {
                        alias /uinnova/thingjsx-data/rsm;
                }
                location /thing/campusbuilder {
                        alias /uinnova/thingjsx-front/campusbuilder;
                }
                location /thing/citybuilder {
                        alias /uinnova/thingjsx-front/citybuilder;
                }
                location /thing/configuration {
                        alias /uinnova/thingjsx-front/configuration;
                }
                location /thing/dtwin {
                        alias /uinnova/thingjsx-front/dtwin;
                }
                location /thing {
                        proxy_connect_timeout 3000;
                        proxy_read_timeout 3000;
                        proxy_send_timeout 3000;
                        proxy_set_header Host $http_host;
                        proxy_pass   http://10.100.32.97:1662/thing;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection "upgrade";
                }
                location / {
                        proxy_connect_timeout 3000;
                        proxy_read_timeout 3000;
                        proxy_send_timeout 3000;
                        proxy_set_header Host $http_host;
                        proxy_pass   http://10.100.32.97:1662;
                }
        }

        server {
                client_max_body_size 20G;
                listen       4434 ssl http2;
                ssl_certificate     /uinnova/nginx/conf/server.crt;
                ssl_certificate_key     /uinnova/nginx/conf/server.key;
                ssl_session_timeout  5m;
                add_header Access-Control-Allow-Origin '*' always;
                add_header Access-Control-Allow-Methods 'GET, PUT, POST, DELETE, OPTIONS';
                add_header Access-Control-Allow-Headers 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
               
                location / {
                        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-Proto $scheme;
                           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                           proxy_redirect http:// https://;
                        proxy_pass http://10.100.32.97:8088;
                }
                location /tarsier-dix/ {
                        proxy_redirect http://10.100.32.97:1551/tarsier-dix/ https://10.100.32.97:4434/tarsier-dix;
                        proxy_pass http://10.100.32.97:1551/tarsier-dix/;
                }
                location /console-api/ {
                        proxy_redirect http://10.100.32.97:1551/console-api/ https://10.100.32.97:4434/console-api;
                        proxy_pass http://10.100.32.97:1551/console-api/;
                }
                location /license/ {
                        proxy_redirect http://10.100.32.97:1551/license/ https://10.100.32.97:4434/license;
                        proxy_pass http://10.100.32.97:1551/license;
                }
        }
}

avatar
游客~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

130700ppkpl8x3t7tt1b1t