-
-
Save fahmiardi/f6b6657609b4d652b7eb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
* code copy+paste from http://forumsarchive.laravel.io/viewtopic.php?id=16598 | |
* | |
*/ | |
# Beginning of my server {...} block skipped | |
# Serve static files directly with max expire | |
location ~* ^/app1/.*\.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|txt)$ { | |
root /var/www/apps.domain.com/Laravel_App1/public; | |
rewrite ^/app1/?(.*)$ /$1 break; | |
try_files $uri =404; | |
expires max; | |
access_log off; | |
} | |
# Forward all related to this sub-folder to an upstream server | |
location ^~ /app1 { | |
root /var/www/apps.domain.com/Laravel_App1/public; | |
rewrite ^/app1/?(.*)$ /$1 break; | |
proxy_pass http://127.0.0.1:8081; | |
proxy_set_header Host $host; | |
} | |
# The rest of this server {...} block skipped, too | |
### Upstream for Laravel App1 | |
server { | |
listen 127.0.0.1:8081; | |
root /var/www/apps.domain.com/Laravel_App1/public; | |
index index.php index.html /index.php; | |
### Static files and "pretty" paths | |
location / { | |
root /var/www/apps.domain.com/Laravel_App1/public; | |
index index.php index.html; | |
try_files $uri $uri/ /app1/index.php$is_args$args; | |
} | |
location ~ /.+\.php$ { | |
try_files $uri /index.php =404; | |
include /etc/nginx/fastcgi.conf; | |
fastcgi_param SCRIPT_FILENAME /var/www/apps.domain.com/Laravel_App1/public$fastcgi_script_name; | |
fastcgi_index index.php; | |
fastcgi_pass php; # "php" is defined in http section: upstream php { server unix:/var/run/php-fpm.sock; } | |
fastcgi_param SERVER_NAME apps.domain.com; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment