Created
March 26, 2014 18:07
-
-
Save mkay/9789587 to your computer and use it in GitHub Desktop.
example ownCloud config for nginx
This file contains hidden or 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
| # owncloud.example.com:80 | |
| server { | |
| listen 0.0.0.0:80; | |
| server_name owncloud.example.com; | |
| rewrite ^ https://$server_name$request_uri? permanent; | |
| } | |
| # owncloud.example.com:443 | |
| server { | |
| listen 0.0.0.0:443; | |
| server_name owncloud.example.com; | |
| access_log /path/to/owncloud/logs/access.log; | |
| error_log /path/to/owncloud/logs/error.log; | |
| root /path/to/owncloud/htdocs/; | |
| index index.php; | |
| gzip off; | |
| client_max_body_size 10G; # set max upload size | |
| fastcgi_buffers 64 4K; | |
| rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect; | |
| rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect; | |
| rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect; | |
| rewrite ^/apps/calendar/caldav.php /remote.php/caldav/ last; | |
| rewrite ^/apps/contacts/carddav.php /remote.php/carddav/ last; | |
| rewrite ^/apps/([^/]*)/(.*\.(css|php))$ /index.php?app=$1&getfile=$2 last; | |
| rewrite ^/remote/(.*) /remote.php last; | |
| error_page 404 /core/templates/404.php; | |
| error_page 403 /core/templates/403.php; | |
| error_page 500 502 503 504 /50x.html; | |
| location = /robots.txt { | |
| allow all; | |
| log_not_found off; | |
| access_log off; | |
| } | |
| location ~ ^/(data|config|\.ht|db_structure\.xml|README) { | |
| deny all; | |
| } | |
| location / { | |
| rewrite ^/.well-known/host-meta /public.php?service=host-meta last; | |
| rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; | |
| rewrite ^/.well-known/carddav /remote.php/carddav/ redirect; | |
| rewrite ^/.well-known/caldav /remote.php/caldav/ redirect; | |
| rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; | |
| try_files $uri $uri/ /index.php$is_args$args; | |
| } | |
| ssl on; | |
| ssl_certificate /path/to/cert.crt; | |
| ssl_certificate_key /path/to/cert.key; | |
| ssl_session_timeout 5m; | |
| ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
| ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; | |
| ssl_prefer_server_ciphers on; | |
| # Webfonts | |
| #location ~* \.(eot|ttf|woff)$ { | |
| # add_header Access-Control-Allow-Origin *; | |
| #} | |
| # PHP | |
| location ~ ^(.+?\.php)(/.*)?$ { | |
| try_files $1 = 404; | |
| include fastcgi_params; | |
| fastcgi_param SCRIPT_FILENAME $document_root$1; | |
| fastcgi_param PATH_INFO $2; | |
| fastcgi_param HTTPS on; | |
| fastcgi_split_path_info ^(.+\.php)(.*)$; | |
| fastcgi_pass unix:/var/run/php5-fpm/owncloud.example.com.sock; | |
| fastcgi_index index.php; | |
| fastcgi_ignore_client_abort on; | |
| fastcgi_param SERVER_NAME $http_host; | |
| } | |
| # Custom error pages | |
| location = /500.html { | |
| root /path/to/errordocs; | |
| } | |
| # Ignore apache heritage | |
| location ~ /\.ht { | |
| deny all; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment