NextCloud on a VPS beside other services

Last modified 2 years, 250 days ago

I host this website, a few other websites, a Gogs instance, and now a NextCloud server on the same cheap VPS from DigitalOcean*. The way I have things set up requires a little more configuration than your standard install, and in the hopes of someone finding it useful, here is how I’ve set up NextCloud on my server.

The quick and dirty version is to use these commands (assuming you can use snaps, which are awesome btw):

sudo snap install nextcloud
sudo nextcloud.manual-install USER PASSWORD   # of course, you should wipe your bash history after this, because your password is now just sitting there...
sudo nextcloud.occ config:system:get trusted_domains   # oh look, it is only allowing localhost, awesome
sudo snap set nextcloud ports.http=8987
sudo nano /etc/nginx/nginx.conf

And with that last command, place the following inside your NGINX configuration:

http {
    server {
        listen 443 ssl;
        server_name your.domain;   # obviously, using your own domain name
        location / {
            proxy_pass http://localhost:8987;
        }
    }
}

The only downside to this is that NextCloud thinks it is being served as localhost:8987, as a result, your “federated” username will have localhost:8987 instead of the domain you’re using. Also logging out will redirect you to a localhost address. These things aren’t too bothersome for me, and it works great so far. :D

Resources

  1. This guide on DigitalOcean’s community.
  2. I initially forgot I was going to be using SSL in a proxy so there’s this, which is helpful for setting up SSL.
  3. This issue on GitHub (and another I lost the link to) is where I found out about the ports.http configuration option. (I love snaps!)

*: That is a referral link because I like DigitalOcean.

Originally published January 13, 2018

Previous Post Next Post