Skip to content

Instantly share code, notes, and snippets.

@emeaguiar
Last active February 9, 2023 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emeaguiar/aa8998e75094197f9a8197073ac936eb to your computer and use it in GitHub Desktop.
Save emeaguiar/aa8998e75094197f9a8197073ac936eb to your computer and use it in GitHub Desktop.
nginx conf
# Basic conf
server {
server_name _;
return 302 $scheme://mysite.test$request_uri;
}
# Custom conf
server {
server_name ~^(.*)\.mysite\.test$ mysite.test;
root /app/public/;
# If file ends with these extensions
location ~* ^.+\.(svg|svgz|jpg|jpeg|gif|png|ico|bmp|webp)$ {
try_files $uri @image_fallback; # Try this address (defined below)
}
# Define URL to try (prod url)
location @image_fallback {
proxy_pass https://mysite.com;
}
# More default conf...
index index.php index.html index.htm;
include do-not-modify/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment