nginx的使用总结

http转https配置:

upstream web {
        ip_hash;
        server 127.0.0.1:8081;
}

server {
        listen 8080;
        server_name www.example.com;
        rewrite ^(.*)$ https://$host$1 permanent;
}

server {
        listen       443 ssl;
        server_name  www.example.com;
        ssl_certificate /home/xxxxx.crt;
        ssl_certificate_key  /home/xxxxx.key;
        add_header Content-Security-Policy upgrade-insecure-requests;
        client_max_body_size 100M;
        proxy_set_header Host $host;
        server_name_in_redirect off;
        port_in_redirect off;
        location / {
            #add_header 'Access-Control-Allow-Origin' '*';
            #add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS';
            #add_header 'Access-Control-Allow-Headers' '*';

            proxy_ignore_client_abort on;
      
            proxy_pass http://web/;
            proxy_intercept_errors on;
            index  index.html index.htm;

            #以下是新增配置
           proxy_connect_timeout      120;   
           proxy_send_timeout         300;    
           proxy_read_timeout         300; 
           #proxy_http_version 1.1;    
           #proxy_set_header Connection ""; 
        }
         error_page  500 502 503 504 /50.html;
         error_page  400 404 /50.html;

         location = /50.html{
                root /etc/nginx;
         }
         location /img/**/pki-validation/ {
                root   /etc/nginx/ssh_txt;
                index  index.html index.htm;
          }
          location /.well-known/pki-validation/ {
                root   /home/ubuntu/fileauth;
                index  index.html index.htm;
          }
    }

相关推荐

  1. nginx使用总结

    2024-03-22 15:32:02       18 阅读
  2. nginx配置详解+nginx_lua模块使用

    2024-03-22 15:32:02       19 阅读
  3. nginx使用入门笔记

    2024-03-22 15:32:02       33 阅读
  4. linux系统nginx监控使用

    2024-03-22 15:32:02       37 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-22 15:32:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-22 15:32:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-22 15:32:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-22 15:32:02       20 阅读

热门阅读

  1. 计算机网络安全试题

    2024-03-22 15:32:02       18 阅读
  2. node.js nvm命令切换到node 14

    2024-03-22 15:32:02       20 阅读
  3. 面试十二、装饰器模式

    2024-03-22 15:32:02       16 阅读
  4. 量化交易入门(十一)Python开发-数据结构

    2024-03-22 15:32:02       16 阅读
  5. 鸡兔同笼套餐

    2024-03-22 15:32:02       16 阅读
  6. 三要素+人像核验接口,身份核验,身份实名认证

    2024-03-22 15:32:02       20 阅读