Domain/cloud,domain/admin


#1

HI Team,
For the current setup, we have same effects of bringing us to mail area, by either using xyz.com/mail or box.xyz.com/mail.

I’d like to have same effects for xyz.com/admin and xyz.com/cloud, instead of box.xyz.com/admin, box.xyz.com/cloud.

I tried modifying, root@box:/home/devnull# cat /etc/nginx/conf.d/local.conf and copied some related sections for /cloud and /admin from box.xyz.com zone to xyz.com zone. It worked out ok, until box reboots when it defaults back to originals.

I was wondering where we can modify existing script, so that I can access xyz.com/cloud,xyz.com/admin, instead of, box.xyz.com/admin, box.xyz.com/cloud.

The end goal is to have same effect like what we have already for email, e.g. xyz.com/mail and box.xyz.com/mail are same effect.

If it’s ok with team, can we have it in next release as well.
thanks for this.


Letsencrypt expired, and dns errors
#2

@JoshData

HI Josh,

I was just wondering whether you can help do a quick update in next release for this feature. If you can make it done within your script, it would be great! So it will not be lost during upgrade.

I noted that the following files can be modified to achieve this,

  1. /etc/nginx/conf.d/local.conf
    domain1.com
    https server section
    #roundcube# section
    adding #cloud# section here, same portion as we have already in box.domain1.com section
    For additional domain, this #cloud# section will be added as well.
    People can then use https://domain1.com/cloud to access owncloud, same as https://domain1.com/mail (which we have already)

People on domain 2, can use https://domain2.com/cloud to access their separate cloud, as they can do https://domain2.com/mail, which we have already.

  1. /home/user-data/owncloud/config.php
    

‘trusted_domains’ =>
array (
0 => ‘box.domain1.com’,
1 => ‘domain1.com’, (adding these new info for first domains)
2 => ‘domain2.ca’, (adding these new info for new domains)
),

Great work on this system!
I am trying to help set this up for some community organisation as well, as part of volunteer effort in promoting opensource solutions such as this and linux, to improve overall security and privacy with computers.

Thanks.
Peng


#3

Or,
How can I create a seperate customized files under /etc/nginx/conf.d/*.conf to add ownlcoud section to running configuratons without touching /etc/nginx/conf.d/local.conf?

So after each upgrade, even local.conf is updated by script, my own part config are still there and be used.

I tried to create one like below under /etc/nginx/conf.d/my.conf

@box:/etc/nginx/conf.d$ cat peng.conf
server {
listen 443 ssl;
listen [::]:443 ssl;

server_name xyz.com;

# ownCloud configuration.
rewrite ^/cloud$ /cloud/ redirect;
rewrite ^/cloud/$ /cloud/index.php;
rewrite ^/cloud/(contacts|calendar|files)$ /cloud/index.php/apps/$1/ redirect;
rewrite ^(/cloud/core/doc/[^\/]+/)$ $1/index.html;
location /cloud/ {
	alias /usr/local/lib/owncloud/;
 	location ~ ^/cloud/(build|tests|config|lib|3rdparty|templates|data|README)/ {
 		deny all;
 	}
 	location ~ ^/cloud/(?:\.|autotest|occ|issue|indie|db_|console) {
 		deny all;
 	}
}
location ~ ^(/cloud)((?:/ocs)?/[^/]+\.php)(/.*)?$ {
	# note: ~ has precendence over a regular location block
	# Accept URLs like:
	# /cloud/index.php/apps/files/
	# /cloud/index.php/apps/files/ajax/scan.php (it's really index.php; see 6fdef379adfdeac86cc2220209bdf4eb9562268d)
	# /cloud/ocs/v1.php/apps/files_sharing/api/v1 (see #240)
	# /cloud/remote.php/webdav/yourfilehere...
	include fastcgi_params;
	fastcgi_param SCRIPT_FILENAME /usr/local/lib/owncloud/$2;
	fastcgi_param SCRIPT_NAME $1$2;
	fastcgi_param PATH_INFO $3;
	fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
	fastcgi_param MOD_X_ACCEL_REDIRECT_PREFIX /owncloud-xaccel;
	fastcgi_read_timeout 630;
	fastcgi_pass php-fpm;
	error_page 403 /cloud/core/templates/403.php;
	error_page 404 /cloud/core/templates/404.php;
	client_max_body_size 1G;
	fastcgi_buffers 64 4K;
}
location ^~ /owncloud-xaccel/ {
	# This directory is for MOD_X_ACCEL_REDIRECT_ENABLED. ownCloud sends the full file
	# path on disk as a subdirectory under this virtual path.
	# We must only allow 'internal' redirects within nginx so that the filesystem
	# is not exposed to the world.
	internal;
	alias /;
}
location ~ ^/((caldav|carddav|webdav).*)$ {
	# Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either.
	# Properly proxying like this seems to work fine.
	proxy_pass https://127.0.0.1/cloud/remote.php/$1;
}
rewrite ^/.well-known/host-meta /cloud/public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /cloud/public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /cloud/remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /cloud/remote.php/caldav/ redirect;

}

server {
listen 443 ssl;
listen [::]:443 ssl;

server_name abc.ca;

# ownCloud configuration.
rewrite ^/cloud$ /cloud/ redirect;
rewrite ^/cloud/$ /cloud/index.php;
rewrite ^/cloud/(contacts|calendar|files)$ /cloud/index.php/apps/$1/ redirect;
rewrite ^(/cloud/core/doc/[^\/]+/)$ $1/index.html;
location /cloud/ {
	alias /usr/local/lib/owncloud/;
 	location ~ ^/cloud/(build|tests|config|lib|3rdparty|templates|data|README)/ {
 		deny all;
 	}
 	location ~ ^/cloud/(?:\.|autotest|occ|issue|indie|db_|console) {
 		deny all;
 	}
}
location ~ ^(/cloud)((?:/ocs)?/[^/]+\.php)(/.*)?$ {
	# note: ~ has precendence over a regular location block
	# Accept URLs like:
	# /cloud/index.php/apps/files/
	# /cloud/index.php/apps/files/ajax/scan.php (it's really index.php; see 6fdef379adfdeac86cc2220209bdf4eb9562268d)
	# /cloud/ocs/v1.php/apps/files_sharing/api/v1 (see #240)
	# /cloud/remote.php/webdav/yourfilehere...
	include fastcgi_params;
	fastcgi_param SCRIPT_FILENAME /usr/local/lib/owncloud/$2;
	fastcgi_param SCRIPT_NAME $1$2;
	fastcgi_param PATH_INFO $3;
	fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
	fastcgi_param MOD_X_ACCEL_REDIRECT_PREFIX /owncloud-xaccel;
	fastcgi_read_timeout 630;
	fastcgi_pass php-fpm;
	error_page 403 /cloud/core/templates/403.php;
	error_page 404 /cloud/core/templates/404.php;
	client_max_body_size 1G;
	fastcgi_buffers 64 4K;
}
location ^~ /owncloud-xaccel/ {
	# This directory is for MOD_X_ACCEL_REDIRECT_ENABLED. ownCloud sends the full file
	# path on disk as a subdirectory under this virtual path.
	# We must only allow 'internal' redirects within nginx so that the filesystem
	# is not exposed to the world.
	internal;
	alias /;
}
location ~ ^/((caldav|carddav|webdav).*)$ {
	# Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either.
	# Properly proxying like this seems to work fine.
	proxy_pass https://127.0.0.1/cloud/remote.php/$1;
}
rewrite ^/.well-known/host-meta /cloud/public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /cloud/public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /cloud/remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /cloud/remote.php/caldav/ redirect;

}

After I restart nginx, it seems not working as intended…

However, if I put them directly in local.conf , it works.

thanks
peng


#4

This topic was automatically closed after 61 days. New replies are no longer allowed.