Created
April 4, 2016 10:39
-
-
Save d1mach/5d315a06c6403c94d64131191161c2e4 to your computer and use it in GitHub Desktop.
UserDir functionality with PHP support for NGINX
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
# userdir.conf | |
server { | |
listen 80; | |
server_name localhost; | |
client_max_body_size 20M; | |
# Declare index files in advance to use .php extension as a selector | |
# to choose the correct location clause | |
index index.php index.html index.htm; | |
# For .php files pass the scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
location ~ ^/~(.+?)(/.+\.php)$ { | |
alias /home/$1/public_html$2; | |
autoindex on; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root; | |
fastcgi_index index.php; | |
fastcgi_pass 127.0.0.1:9000; | |
} | |
# For serving static files and autogenerated directory indices | |
# turn autoindex on | |
location ~ ^/~(.+?)(/.*)?$ { | |
alias /home/$1/public_html$2; | |
autoindex on; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment