Instructions to install ownCloud on CentOS 7 - HOSTVN Blog

upstream php-handler {

server unix:/var/run/php-fpm.sock;

}

server {

listen 80;

server_name www.owncloud.hostvn.com owncloud.hostvn.com;

access_log /var/log/owncloud.log;

access_log /var/log/owncloud.bytes bytes;

error_log /var/log/owncloud.error.log;

root /var/www/html/owncloud;

index index.html index.htm index.php;

location /.well-known/(acme-challenge|pki-validation)/ {

root /var/www/html/owncloud;

}

location = /robots.txt {

allow all;

log_not_found off;

access_log off;

}

location = /.well-known/carddav {

return 301 $scheme://$host/remote.php/dav;

}

location = /.well-known/caldav {

return 301 $scheme://$host/remote.php/dav;

}

client_max_body_size 512M;

fastcgi_buffers 8 4K;

fastcgi_ignore_headers X-Accel-Buffering;

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)/ {

return 404;

}

location ~ ^/(?:.|autotest|occ|issue|indie|db_|console) {

return 404;

}

location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v(twelfth)|updater/.+|ocs-provider/.+|ocm-provider/.+|core/templates/40(34)).php(?:$|/) {

fastcgi_split_path_info ^(.+.php)(/.*)$;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_param modHeadersAvailable true;

fastcgi_param front_controller_active true;

fastcgi_read_timeout 180;

fastcgi_pass php-handler;

fastcgi_intercept_errors on;

fastcgi_request_buffering off;

}

location ~ ^/(?:updater|ocs-provider|ocm-provider)(?:$|/) {

try_files $uri $uri/ =404;

index index.php;

}

location ~ .(?:css|js)$ {

try_files $uri /index.php$uri$is_args$args;

add_header Cache-Control "max-age = 15778463" always;

add_header X-Nội dung-Type-Options nosniff always;

add_header X-Frame-Options "SAMEORIGIN" always;

add_header X-XSS-Protection "1; mode = block" always;

add_header X-Robots-Tag none always;

add_header X-Download-Options noopen always;

add_header X-Permitted-Cross-Domain-Policies none always;

access_log off;

}

location ~ .(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg|map|json)$ {

add_header Cache-Control "public, max-age = 7200" always;

try_files $uri /index.php$uri$is_args$args;

access_log off;

}

}