Last active
August 29, 2015 14:15
-
-
Save dratini0/4e4a5282f25eb2d6ea9c to your computer and use it in GitHub Desktop.
Config for the proposed X-Accel-Redirect behavior
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 { | |
# standard statements | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www/; | |
index index.php index.html index.htm; | |
try_files $uri $uri/ =404; | |
# these blocks roughly correspond to the XSendFilePath directive in apache | |
# essentially whitelisting parts of the filesystem for x-accel-redirect access | |
# non-standard data dir | |
location ^~ /oc_sendfile_prefix/home/oc_data/ { | |
internal; | |
alias /home/oc_data/; | |
} | |
# temp dir | |
location ^~ /oc_sendfile_prefix/tmp/oc-noclean/ { | |
internal; | |
alias /tmp/oc-noclean/; | |
} | |
# a local mount | |
location ^~ /oc_sendfile_prefix/home/dratini0/Pictures/ { | |
internal; | |
alias /home/dratini0/Pictures/; | |
} | |
location ~ \.php(/.*)?$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_buffers 64 4K; | |
fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on; | |
# this is the new variable I have introduced | |
fastcgi_param MOD_X_ACCEL_REDIRECT_PREFIX /oc_sendfile_prefix/; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
} | |
# the rest is just commonplace a config again | |
location ~ /\.ht { | |
deny all; | |
} | |
location ~ ^/owncloud/(data|config|db_structure\.xml|README) { | |
deny all; | |
} | |
client_max_body_size 10G; # set max upload size | |
location /owncloud/ { | |
error_page 403 /owncloud/core/templates/403.php; | |
error_page 404 /owncloud/core/templates/404.php; | |
} | |
location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf|svg|svgz)$ { | |
expires 30d; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment