Last active
August 17, 2016 16:02
-
-
Save mrdaemon/208bc97034672ccb13999d02d6598f9f to your computer and use it in GitHub Desktop.
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 { | |
# Default server, listen on port 80 ipv4 and ipv6 | |
# No SSL for now, it's terminated at the proxy level anyways. | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www; | |
index index.html index.htm; | |
server_name _; | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
try_files $uri $uri/ =404; | |
} | |
# RPC2 endpoint for rutorrent | |
location /RPC2 { | |
include scgi_params; | |
scgi_pass localhost:5000; | |
} | |
# Run php scripts through hhvm runtime over fcgi | |
location ~ \.php$ { | |
# regex to split $uri to $fastcgi_script_name and $fastcgi_path | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
# Check that the PHP script exists before passing it | |
try_files $fastcgi_script_name =404; | |
# Bypass the fact that try_files resets $fastcgi_path_info | |
# see: http://trac.nginx.org/nginx/ticket/321 | |
set $path_info $fastcgi_path_info; | |
fastcgi_param PATH_INFO $path_info; | |
fastcgi_index index.php; | |
include fastcgi.conf; | |
fastcgi_pass unix:/var/run/php-fpm.sock; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment