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.
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
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_pass 127.0.0.1:9000;
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;
}
}
Comments
Nginx configuration is something hard when you don't know how it works. You should understand the logic and only then you can do it well. Otherwise other webservers will be better choice.
yep, I'm learning everyday & stuck on this one
This is the vanilla nginx config as proposed by OwnCloud:
https://doc.owncloud.org/server/8.0/admin_manual/installation/nginx_configuration.html
resolved, thanks all for replying me