Skip to content

Instantly share code, notes, and snippets.

@melroy89
Created May 27, 2016 11:48
Show Gist options
  • Save melroy89/6ccce3663487162cb7c622bc337b2f59 to your computer and use it in GitHub Desktop.
Save melroy89/6ccce3663487162cb7c622bc337b2f59 to your computer and use it in GitHub Desktop.
ownCloud config for melroy domain

server { listen 80; server_name cloud.melroy.org;

return 301 https://$server_name$request_uri; }

server { listen 443 ssl; server_name cloud.melroy.org;

ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key;

#add_header Strict-Transport-Security “max-age=15768000; includeSubDomains; preload;”; add_header X-Content-Type-Options nosniff; add_header X-Frame-Options “SAMEORIGIN”; add_header X-XSS-Protection “1; mode=block”; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none;

root var/www/owncloud;

location = /robots.txt { allow all; log_not_found off; access_log off; }

#rewrite ^/.well-known/host-meta public.php?service=host-meta last; #rewrite ^.well-known/host-meta.json /public.php?service=host-meta-json last;

location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; } location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; }

location /.well-known/acme-challenge { }

client_max_body_size 512M; fastcgi_buffers 64 4K;

gzip off;

#pagespeed off;

error_page 403 /core/templates/403.php; error_page 404 /core/templates/404.php;

location / { rewrite ^ /index.php$uri; }

location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; } location ~ ^/(?:.|autotest|occ|issue|indie|db_|console) { deny all; }

location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34]).php(?:$|/) { include fastcgi_params; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice fastcgi_param front_controller_active true; fastcgi_pass php-handler; fastcgi_intercept_errors on; fastcgi_request_buffering off; }

location ~ ^/(?:updater|ocs-provider)(?:$|/) { try_files $uri/ =404; index index.php; }

location ~* .(?:css|js)$ { try_files $uri /index.php$uri$is_args$args; add_header Cache-Control “public, max-age=7200”;

#add_header Strict-Transport-Security “max-age=15768000; includeSubDomains; preload;”; add_header X-Content-Type-Options nosniff; add_header X-Frame-Options “SAMEORIGIN”; add_header X-XSS-Protection “1; mode=block”; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none;

access_log off; }

location ~* .(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ { try_files $uri /index.php$uri$is_args$args;

access_log off; } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment