diff options
Diffstat (limited to 'example_nginx_vhost.conf')
-rw-r--r-- | example_nginx_vhost.conf | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/example_nginx_vhost.conf b/example_nginx_vhost.conf new file mode 100644 index 000000000000..f149c6393bfa --- /dev/null +++ b/example_nginx_vhost.conf @@ -0,0 +1,79 @@ +# Based on Grant Carthew work : http://pyd.io/nginx/ +# And also and vovan work here : https://pyd.io/f/topic/nginx-configuration-for-pydio-6-beta/ +# And now reworked for Pydio 6.x based on Pydio wiki + +server { + listen 80; + server_name pydio.local; + + root /usr/share/webapps/pydio; + index index.php; + + access_log /var/log/nginx/pydio6.access.log; + error_log /var/log/nginx/pydio6.error.log; + + client_max_body_size 20G; + client_body_buffer_size 128k; + + location ^~ (/dashboard|/settings|/welcome|/ws-) { + try_files /index.php =404; + } + + location ^~ /shares { + try_files /dav.php =404; + } + location ^~ /api { + try_files /rest.php =404; + } + location ^~ /user { + try_files ./index.php?get_action=user_access_point =404; + } + + location ~ ^/data/public/([a-zA-Z0-9_-]+)\.php$ { + try_files /data/public/share.php?hash=$1 =404; + } + + location ^~ ^/data/public/([a-zA-Z0-9_-]+)--([a-z]+)$ { + try_files /data/public/share.php?hash=$1&lang=$2 =404; + } + + location ^~ ^/data/public/([a-zA-Z0-9_-]+)$ { + try_files /data/public/share.php?hash=$1&lang=$2 =404; + } + + # Prevent Clickjacking + add_header X-Frame-Options "SAMEORIGIN"; + + # Do not accept DELETE, SEARCH and other methods + if ( $request_method !~ ^(GET|HEAD|POST|PROPFIND|OPTIONS)$ ) { + return 444; + } + + # Drop unauthorized access + location ~* ^/(?:\.|conf|data/(?:files|personal|logs|plugins|tmp|cache)|plugins/editor.zoho/agent/files) { + deny all; + } + location = /robots.txt { access_log off; log_not_found off; } + location = /favicon.ico { access_log off; log_not_found off; } + + # Enables PHP + location ~ \.php { + # for ^/(index|plugins) request_uri should be changed + set $request_url $request_uri; + if ( $uri ~ ^/(index|plugins) ) { + set $request_url /; + } + fastcgi_param PHP_ADMIN_VALUE "open_basedir=/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/:/var/lib/pydio/"; + fastcgi_param SCRIPT_FILENAME $request_filename; + include /etc/nginx/fastcgi_params; + fastcgi_pass unix:/run/php-fpm/php-fpm.sock; + } + + # Enables Caching + location ~* \.(ico|css|js)$ { + expires 7d; + add_header Pragma public; + add_header Cache-Control "public, must-revalidate, proxy-revalidate"; + } +} + |