0% found this document useful (0 votes)
40 views2 pages

Nginx Reverse Proxy: Force HTTPS to HTTP

This document contains an Nginx configuration file that sets up reverse proxying and forces HTTPS. It has two server blocks: one for port 443 that handles HTTPS with SSL certificates for encryption, and another on port 80 that redirects HTTP to HTTPS and sets up caching and proxying to an application on port 8154. The second block redirects HTTP to HTTPS, enables caching, and proxies requests to the application while setting headers and caching configurations.

Uploaded by

bambang widianto
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Nginx Reverse Proxy: Force HTTPS to HTTP

This document contains an Nginx configuration file that sets up reverse proxying and forces HTTPS. It has two server blocks: one for port 443 that handles HTTPS with SSL certificates for encryption, and another on port 80 that redirects HTTP to HTTPS and sets up caching and proxying to an application on port 8154. The second block redirects HTTP to HTTPS, enables caching, and proxies requests to the application while setting headers and caching configurations.

Uploaded by

bambang widianto
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Nginx Reverse proxy force https to http

Di [Link]
http {
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:10m
inactive=24h max_size=1g;

server {
server_name [Link];

if ($host = [Link]) {
return 301 [Link]
} # managed by Certbot

listen [::]:443 ssl ipv6only=on; # managed by Certbot


listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/e-
[Link]/[Link]; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/e-
[Link]/[Link]; # managed by Certbot
include /etc/letsencrypt/[Link]; # managed by Certbot
ssl_dhparam /etc/letsencrypt/[Link]; # managed by Certbot

return 404; # managed by Certbot

}
server {

listen 80;
listen [::]:80;
server_name [Link];
# proxy_cache mycache;
# proxy_cache_methods GET HEAD POST;

#location ~* \.(html)$ {
# etag on;
# add_header Cache-Control "no-cache";
# }

location / {
# proxy_set_header Host $host;
# proxy_set_header Accept-Encoding "";

proxy_set_header X-Real-IP $remote_addr;


proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass [Link]
proxy_buffering on;
proxy_cache STATIC;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;

You might also like