Nginx – Clrs http://192.168.0.138:8083 记录美好生活 Sat, 02 Apr 2022 23:32:34 +0000 zh-CN hourly 1 http://192.168.0.138:8083/wp-content/uploads/2022/04/cropped-无标题-32x32.png Nginx – Clrs http://192.168.0.138:8083 32 32 Nginx configuration reverse proxy http://192.168.0.138:8083/nginx-configuration-reverse-proxy/ Sat, 02 Apr 2022 23:20:48 +0000 http://192.168.0.138:8083/?p=37 Reverse proxy

#PROXY-START/
location  ~* \.(php|jsp|cgi|asp|aspx)$
{
    proxy_pass https://clrs.me;
    proxy_set_header Host clrs.me;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_ssl_name clrs.me;
	proxy_ssl_server_name on;
    proxy_connect_timeout 300s;
	proxy_send_timeout 300s;
	proxy_read_timeout 300s;
}

location /
{
    proxy_pass https://clrs.me;
    proxy_set_header Host clrs.me;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
     proxy_ssl_name clrs.me;
	proxy_ssl_server_name on;
    add_header X-Cache $upstream_cache_status;
    proxy_connect_timeout 300s;
	proxy_send_timeout 300s;
	proxy_read_timeout 300s;
    #Set Nginx Cache
    
    	add_header Cache-Control no-cache;
    expires 12h;
}

#PROXY-END/

Reverse proxy restricted path

#PROXY-START/
location  ~* \.(php|jsp|cgi|asp|aspx)$
{
    proxy_pass https://clrs.me;
    proxy_set_header Host clrs.me;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_ssl_name clrs.me;
	proxy_ssl_server_name on;
}
#according to routing config
location /3rd/pay
{
    proxy_pass https://clrs.me;
    proxy_set_header Host clrs.me;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_ssl_name clrs.me;
	proxy_ssl_server_name on;
    add_header X-Cache $upstream_cache_status;
    
    #Set Nginx Cache
    
    add_header Cache-Control no-cache;
    expires 12h;
}

#Match multiple routes
location ~* /3rd/(outtime|save).html
{
    proxy_pass https://clrs.me;
    proxy_set_header Host clrs.me;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_ssl_name clrs.me;
	proxy_ssl_server_name on;
    add_header X-Cache $upstream_cache_status;
    
    #Set Nginx Cache
    
    add_header Cache-Control no-cache;
    expires 12h;
}
]]>
Nginx configuration prohibits access to php scripts in the path http://192.168.0.138:8083/nginx-configuration-prohibits-access-to-php-scripts-in-the-path/ Sat, 02 Apr 2022 23:14:13 +0000 http://192.168.0.138:8083/?p=30 Nginx configuration prohibits access to php scripts in the path
Multiple path
Multiple suffixes

 #匹配多个上传目录
location ~ ^/(uploads|static|data|dist|docs|layer_mobile|layui|sldate|swagger)
{
        # 匹配文件最名包含两个.以上的文件
        location ~ "([.]{2,})$"
        {
                deny all;
        }
        # 配置php和php5后缀
        location ~ ".(php|php5)$"
        {
                deny all;
        }
}
]]>