Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Nginx Configurations for ownCloud
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Nginx Configurations for ownCloud

HaroldMHaroldM Member

I had ownCloud hosted in apache server and I migrate it to nginx server recently. now all the jquery parts broken because some file paths can't load. I think I miss something in my nginx configuration file. ( URL Rewrite ) can you please give me a correct one ?

Here is my current configuration file.

server {
server_name cloud.localhost.local;
access_log /home/owncloud/logs/access.log;
error_log /home/owncloud/logs/error.log;
root /home/owncloud/public_html;

client_max_body_size 10G;
fastcgi_buffers 64 4K;
gzip off;

rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;

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

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

location ~ ^/(?:\.htaccess|data|config|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;

location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /home/owncloud/public_html$fastcgi_script_name;

location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
    expires 30d;
    access_log off;



Sign In or Register to comment.