Skip to content

Instantly share code, notes, and snippets.

@simonbru
Created August 21, 2015 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonbru/a61b8897249afc9136cd to your computer and use it in GitHub Desktop.
Save simonbru/a61b8897249afc9136cd to your computer and use it in GitHub Desktop.
owncloud-config
## uwsgi log ##
[pid: 22084|app: -1|req: -1/347] 2001:xxxx::x () {30 vars in 412 bytes} [Tue Aug 18 22:38:06 2015] GET /status.php => generated 95 bytes in 107 msecs (HTTP/1.1 200) 10 headers in 560 bytes (0 switches on core 0)
[pid: 22084|app: -1|req: -1/348] 2001:xxxx::x () {30 vars in 429 bytes} [Tue Aug 18 22:38:06 2015] HEAD /remote.php/webdav/ => generated 0 bytes in 155 msecs (HTTP/1.1 401) 11 headers in 626 bytes (0 switches on core 0)
[pid: 22084|app: -1|req: -1/349] 2001:xxxx::x () {32 vars in 477 bytes} [Tue Aug 18 22:38:21 2015] HEAD /remote.php/webdav/ => generated 0 bytes in 452 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
## nginx error logs ##
2015/08/18 22:38:22 [error] 10647#0: *178914 upstream prematurely closed connection while reading response header from upstream, client: 2001:xxxx::x, server: domain.com, request: "HEAD /remote.php/webdav/ HTTP/1.1", upstream: "uwsgi://unix:/var/run/uwsgi/app/owncloud/socket:", host: "domain.com"
## nginx access logs ##
2001:xxxx::x - - [18/Aug/2015:22:40:24 +0200] "GET /status.php HTTP/1.1" 200 106 "-" "Mozilla/5.0 (Android) ownCloud-android/1.7.2"
2001:xxxx::x - - [18/Aug/2015:22:40:24 +0200] "HEAD /remote.php/webdav/ HTTP/1.1" 401 0 "-" "Mozilla/5.0 (Android) ownCloud-android/1.7.2"
2001:xxxx::x - simon [18/Aug/2015:22:40:29 +0200] "HEAD /remote.php/webdav/ HTTP/1.1" 502 0 "-" "Mozilla/5.0 (Android) ownCloud-android/1.7.2"
server {
listen 80;
listen [::]:80;
server_name domain.com
return 301 https://$server_name$request_uri;
}
server {
#HTTPS OPTION
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate certs/domain.crt
ssl_certificate_key certs/domain.key;
#maybe disable later
gzip on;
server_name domain.com;
charset utf-8;
access_log /var/log/nginx/owncloud.access.log;
root /var/www/owncloud;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
#this is to avoid Request Entity Too Large error
client_max_body_size 10G;
add_header Strict-Transport-Security "max-age=15768000";
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
# deny access to some special files
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
deny all;
}
# pass all .php or .php/path urls to uWSGI
location ~ ^(.+\.php)(.*)$ {
include uwsgi_params;
uwsgi_modifier1 14;
uwsgi_pass unix:/var/run/uwsgi/app/owncloud/socket;
uwsgi_read_timeout 500;
uwsgi_send_timeout 500;
gzip off;
}
# everything else goes to the filesystem,
# but / will be mapped to index.php and run through uwsgi
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
root /var/www/owncloud;
index index.php;
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;
}
# Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
}
}
[uwsgi]
plugins = php
chown-socket = www-data:www-data
uid = owncloud
gid = owncloud
master = true
cheaper = 1
processes = 4
# schedule command every 3 minutes
cron = -3 -1 -1 -1 -1 /usr/bin/php -f /var/www/owncloud/cron.php 1>/dev/null
#file-serve-mode x-accel-redirect
#env MOD_X_ACCEL_REDIRECT_ENABLED=on
php-docroot = /var/www/owncloud
php-index = index.php
owncloud_data_dir=/var/www/owncloud/data
# set php configuration for this instance of php, no need to edit global php.ini
php-set = date.timezone=Europe/Paris
php-set = open_basedir=%(owncloud_data_dir):/tmp/:/usr/share/php:/var/www/owncloud:/sto/owncloud:/sto/notes:/sto/dropbox:/sto/dropbox/Dropbox:/dev/urandom:/dev/random
php-set = session.save_path=/tmp/owncloud
php-set = post_max_size=2000M
php-set = upload_max_filesize=2000M
php-set = max_execution_time=3000
php-set = always_populate_raw_post_data=-1
php-set = apc.enable_cli=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment