Last active
December 20, 2015 01:59
-
-
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..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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