webinoly/templates/template-site-proxy
Cristhian Martínez Ochoa a018c82b0e xml
FIX, xml files like sitemaps failing when dynamically generated (not static), like in WP.
2023-02-26 10:05:40 -07:00

54 lines
2.7 KiB
Text

# REVERSE PROXY NGINX CONFIGURATION by Webinoly
location / {
# Set the Host header to $host in case you want to preserve the original host value. (proxy_set_header Host $host;)
# Set the Host header to match the destination server (may be needed) to connect with external resources. (proxy_set_header Host 'your.s3.us-east-1.amazonaws.com';)
# The latest can't be used with multiple destinations or load-balancing, which is one of the main features of nginx upstreams.
# The purpose of the Host header in to indicate to the remote server which website you are trying to access and is critical if an IP address is being shared with multiple sites.
#proxy_set_header Host $host;
#proxy_set_header X-Forwarded-Host $host;
#proxy_set_header X-Forwarded-Server $host;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_set_header X-Real-IP $remote_addr;
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade
# It can be used by a client to upgrade a connection from HTTP 1.1 to HTTP 2.0, or an HTTP or HTTPS connection into a WebSocket.
# We prefer 1.1 and keepalive because nginx don't have support for 2.0 in proxy/upstream - https://trac.nginx.org/nginx/ticket/923
# For Upgrade, should be set Connection "upgrade" below and keepalive disabled in the upstream.
#proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_ignore_headers Set-Cookie;
proxy_intercept_errors on;
#proxy_next_upstream error timeout http_500;
# Upstream defined here: conf.d/upstream_proxy.conf
proxy_pass <upstream_name>;
# CacheStaticFiles
location ~* \.(3gp|3gpp|7z|aac|ai|asf|asx|atom|avi|avif|bin|bmp|bz2|cast|cco|crt|css|cur|deb|der|dll|dmg|doc|docx|ear|eot|eps|exe|flv|gif|gz|heic|hqx|htc|ico|img|iso|jad|jar|jardiff|jng|jnlp|jpeg|jpg|js|json|kar|kml|kmz|m3u8|m4a|m4v|mid|midi|mml|mng|mov|mp3|mp4|mpeg|mpg|msi|msm|msp|odg|odp|ods|odt|ogg|ogv|otf|pdb|pdf|pem|pl|pm|png|ppt|pptx|prc|ps|ra|rar|rpm|rss|rtf|run|sea|sit|svg|svgz|swf|tar|taz|tcl|tgz|tif|tiff|tk|ts|ttf|txt|tz|war|wasm|wav|wbmp|webm|webmanifest|webp|wml|wmlc|wmv|woff|woff2|xhtml|xls|xlsx|xpi|xspf|z|zip)$ {
# More info about this location, read the notes included here: /opt/webinoly/templates/nginx/common/headers.conf
include common/headers-http.conf;
include common/headers-https.conf;
add_header "Access-Control-Allow-Origin" "*";
access_log off;
log_not_found off;
expires max;
proxy_pass <upstream_name>;
}
# BasicLocationRootFiles
location = /robots.txt {
access_log off;
log_not_found off;
proxy_pass <upstream_name>;
}
# BasicLocEnd
}