Skip to content

Instantly share code, notes, and snippets.

@Mulkave
Last active December 20, 2015 01:59
Show Gist options
  • Save Mulkave/6053000 to your computer and use it in GitHub Desktop.
Save Mulkave/6053000 to your computer and use it in GitHub Desktop.
A virtual host script to serve Laravel bundles as a dedicated website. ## Example A bundle called mybundle hosted under http://example.com/mybundle to be accessible through http://mybundle.com through the same code base avoiding code duplication and blabla..
server {
listen 80;
server_name mybundle.com;
# Redirect root traffic to bundle route
location / {
rewrite (.*) /mybundle break;
proxy_pass http://example.com;
}
# Prefix bundle routes
location ~* /mybundle/(.*) {
rewrite (.*) /$1 break;
proxy_pass http://example.com;
}
# Serve static content directly
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
log_not_found off;
rewrite (.*) /$1 break;
proxy_pass http://example.com;
# Cache control
expires max;
add_header Cache-Control private;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment