美文网首页
Nginx 配置反向代理

Nginx 配置反向代理

作者: 索性流年 | 来源:发表于2021-03-31 09:24 被阅读0次


#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;
    sendfile        on;
    keepalive_timeout  65;

# HTTP server
#    server {
#        listen       80;
#        server_name  localhost;
#        location / {
#            proxy_pass         http://localhost:8080;
#            proxy_set_header   Host $host;
#            proxy_set_header   X-Real-IP            $remote_addr;
#            proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
#            root   html;
#            index  index.html index.htm;
#        }
#
#        error_page   500 502 503 504  /50x.html;
#        location = /50x.html {
#            root   html;
#        }
#
#    }


    # HTTPS server
    #
    server {
        listen       443 ssl;
        server_name  rtdws.bjucd.com;

        ssl_certificate      /https/5322381__bjucd.com.pem;
        ssl_certificate_key  /https/5322381__bjucd.com.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            proxy_pass http://localhost:8080;
            root   html;
            index  index.html index.htm;
            proxy_set_header X-Real-IP $remote_addr;
        }
        #配置图片访问地址
        location ~*(?!(\\.jpg|\\.png)).+?(\\.jpg|\\.png) {
            proxy_pass         http://localhost:9000;
        }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
          #配置静态资源
       location /web/ {
            alias   D:/nginx-1.18.0/html/kmdataplatform-web/;
            autoindex on;
        }
    }
}

相关文章

  • Nginx应用场景

    反向代理,负载均衡,动静分离 1.反向代理 修改nginx配置,并重新加载 重新加载nginx配置./nginx ...

  • 01-nginx前端方向代理

    前端反向代理 1.下载nginx 2. 配置nginx.conf反向代理

  • nginx

    nginx的配置、虚拟主机、负载均衡和反向代理一nginx的配置、虚拟主机、负载均衡和反向代理二nginx的配置、...

  • nginx反向代理

    什么是反向代理 如何实现反向代理 准备工作以及安装nginx 配置nginx nginx的初始配置文件去掉注释后的...

  • nginx 配置

    nginx 多个 root页面配置 反向代理

  • 第二课 nginx+tomcat集群

    正向代理,反向代理 配置Nginx 配置文件目录:/usr/local/nginx-1.6.1/conf/ngin...

  • nginx+tomcat集群

    正向代理,反向代理 配置Nginx 配置文件目录:/usr/local/nginx-1.6.1/conf/ngin...

  • nginx+tomcat集群

    正向代理,反向代理 配置Nginx 配置文件目录:/usr/local/nginx-1.6.1/conf/ngin...

  • Nginx 负载均衡/反向代理配置

    反向代理: 修改nginx配置nginx.conf文件: 在location /{ #...

  • Nginx系列10:nginx的反向代理配置

    1. 理解什么是反向代理 关于反向代理的概念可以参考上一篇文章《Nginx系列9:nginx正反向代理概念与配置》...

网友评论

      本文标题:Nginx 配置反向代理

      本文链接:https://www.haomeiwen.com/subject/yikohltx.html