Skip to content

Instantly share code, notes, and snippets.

@corpix
Created April 29, 2012 15:35
Show Gist options
  • Save corpix/2551325 to your computer and use it in GitHub Desktop.
Save corpix/2551325 to your computer and use it in GitHub Desktop.
Own Cloud nginx config
server {
listen 80;
server_name cloud.yourhost.ru;
rewrite ^ https://$server_name$request_uri? permanent;
}
# HTTPS
server {
listen 443 ssl;
server_name cloud.yourhost.ru;
ssl_certificate /etc/nginx/certs/owncloud.crt;
ssl_certificate_key /etc/nginx/certs/owncloud.key;
root /storage/owncloud/scripts/;
index index.php;
client_max_body_size 5G;
location ~ ^/(data|config|\.|db_structure\.xml) {
deny all;
}
location /dav/ {
fastcgi_param SCRIPT_FILENAME /storage/owncloud/scripts/files/webdav.php;
include fastcgi_params;
root /storage/owncloud/scripts/files;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}
location / {
try_files $uri $uri/ @webdav;
}
location @webdav {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment