Created
December 4, 2017 19:09
-
-
Save IkarosKappler/482cd87315cc316147cf568ab31c742b to your computer and use it in GitHub Desktop.
Configuration | Nginx user_dir public_html with PHP execution (+fastCGI)
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; | |
listen [::]:80 default_server ipv6only=on; | |
server_name _; | |
root /usr/share/nginx/www; | |
index index.php index.html index.htm; | |
# Deny access to all dotfiles | |
location ~ /\. { | |
deny all; | |
} | |
location ~ \.php$ { | |
include /etc/nginx/fastcgi_params; | |
try_files $uri = 404; # Prevents exploit | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
} | |
# Serve user directories | |
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