Last active
August 29, 2015 14:16
-
-
Save StephenRadachy/46394b209712be064676 to your computer and use it in GitHub Desktop.
Serving from home directories with Nginx + PHP5-fpm
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
# Serving from home directories | |
# With Nginx + PHP5-fpm | |
# | |
# NOTE: The order of these blocks CANNOT be changed | |
# | |
# Stephen J Radachy <sjradach@mtu.edu> | |
# Enable PHP within home directories | |
location ~ ^/~(.+?)(/.*\.php)$ { | |
alias /home/$1/public_html; | |
autoindex on; | |
include fastcgi_params; | |
try_files $2 = 404; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
} | |
# Enable PHP on entire site | |
location ~ \.php$ { | |
try_files $uri = 404; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
# Enable serves from home directories | |
location ~ ^/~(.+?)(/.*)?$ { | |
alias /home/$1/public_html$2; | |
index index.html index.htm index.php; | |
autoindex on; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment