Created
December 10, 2015 22:46
-
-
Save bdwyertech/d5b1e097ea158a232aa3 to your computer and use it in GitHub Desktop.
Nginx - Nested locations and PHP-FPM
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
# => YOURLS URL Shortener Configuration | |
location /u/ { | |
root /var/www/api/urls/; | |
rewrite ^/(.*)/$ /$1/index.php last; # Enables index functionality (only really used for /u/admin/) | |
rewrite ^/u/(.*)$ /$1 break; # Strips /u/ from the URI for static files | |
try_files $uri /u/yourls-loader.php$is_args$args; | |
# => API PHP-FPM | |
location ~ \.php$ { | |
fastcgi_split_path_info ^/u(.+?\.php)(.*)$; | |
try_files $fastcgi_script_name =404; | |
include /etc/nginx/fastcgi_params; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
#fastcgi_param PATH_INFO $fastcgi_path_info; | |
#fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | |
fastcgi_pass unix:/var/run/pipeline.sock; # port where FastCGI processes were spawned | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh boy, this saved my sanity after hours of pulling my hair off. What a clusterfuck nested locations are.