nginx学习笔记

阅读量: searchstar 2023-06-11 17:12:21
Categories: Tags:

https server

server {
        listen 端口 ssl http2;
        listen [::]:端口 ssl http2;
        server_name __domain_name__;
        ssl_certificate __cert_dir__/fullchain.cer;
        ssl_certificate_key __cert_dir__/__domain_name__.key;
        location / { 
                root /home/wwwroot/;
        }   
}

alias / root

alias类似于proxy_pass,会自动把跟location match的部分从URI中删掉。而root仍然会保留location里的部分。

文档:http://nginx.org/en/docs/http/ngx_http_core_module.html#alias

参考:

https://stackoverflow.com/questions/11570321/configure-nginx-with-multiple-locations-with-different-root-folders-on-subdomain

https://stackoverflow.com/questions/28130841/removing-start-of-path-from-nginx-proxy-pass

Remove path prefix during proxy_pass

存在的问题

client_max_body_size

文档:https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

stream块好像也会检查body size,但是client_max_body_size只支持http块,不支持stream块。