# Snap with nginx reverse proxy

**URL:** <https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603>\
**Category:** ℹ️ Support\
**Tags:** snap, mac\
**Created:** [October 5, 2026, 11:13pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603 "2026-10-05T23:13:17Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![RGaskin](https://help.nextcloud.com/letter_avatar/rgaskin/32/6_449c533f586939b6e5f246632a46421f.png) [@RGaskin](https://help.nextcloud.com/u/RGaskin)\
**Post date:** [October 5, 2026, 11:13pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/1 "2026-10-05T23:13:17Z")

</div>

**The Basics**

- Nextcloud Server version _(e.g., 29.x.x)_:
  - `34.04? (the site is currently inaccessible so that's the best I recall)`

- Operating system and version _(e.g., Ubuntu 24.04)_:
  - `Ubuntu 24.04`

- Web server and version _(e.g, Apache 2.4.25)_:
  - `Whatever that Snap version is using`

- Reverse proxy and version \_(e.g. nginx 1.27.2)
  - `Nginx 1.24.0`

- PHP version _(e.g, 8.3)_:
  - `Whatever that Snap version is using`

- Is this the first time you’ve seen this error? (Yes / No):
  - `Yes`

- When did this problem seem to first start?
  - `yesterday evening`

- Installation method _(e.g. AlO, NCP, Bare Metal/Archive, etc.)_
  - `Snap on VPS, with Nginx added via apt later`

- Are you using CloudfIare, mod\_security, or similar? _(Yes / No)_
  - `no`

### Summary of the issue you are facing:

Previously working reverse proxy of Snap behind Nginx stopped working two days after I last used it, with no direct intervention on my part.

### Steps to replicate it (hint: details matter!):

1. I used this tutorial to set things up:  
[Tutorial: Nextcloud snap with other services on the same server](https://www.nicemicro.com/tutorials/debian-snap-nextcloud.html#nginx-setup)

2. I enjoyed using it for a couple weeks.

3. Attempting to log in now fails due to a cert error, but interestingly different depending on the browser:

I have a reasonable level of experience with small server admin, but not with the details of cert management or managing them with a reverse proxy.

Any guidance on next steps to diagnose or resolve welcome. Thank you for your time reading this.

---

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [October 6, 2026, 6:57am UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/2 "2026-10-06T06:57:37Z")

</div>

Hey @RGaskin welcome back 👋

can you show your config:

### View system configuration

```auto
sudo nextcloud.occ config:list system

```

especially your trusted domains… as both subdomains should be listed there:

## Setting **trusted domains**

Adding multiple trusted domains manually in `config.php`:

- edit `config.php`

```auto
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php 

```

and add/edit section

```auto
 'trusted_domains' =>
  array (
    0 => 'cloud.yourdomain.xyz',
    1 => 'cloud.yourotherdomain.zxy',
    2 => 'localhost',
    3 => 'nextcloud.local',
  ),

```

or issue occ command on host (iterating values 0, 1, 2…):

```auto
sudo nextcloud.occ config:system:set trusted_domains 0 --value=cloud.yourdomain.xyz

```

Caution

Be aware that the values for `trusted_domains` should be domain names (see [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name)). IP addresses are not domain names! See [hosts & FQDN configuration](https://github.com/nextcloud-snap/nextcloud-snap/wiki/Hosts-and-FQDN-for-Nextcloud-snap#fqdn-fully-qualified-domain-name).

## Setting trusted proxies

Adding trusted proxies manually in `config.php`:

edit `config.php` and add/edit section

```auto
sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php 

```

```auto
  'trusted_proxies' => 
  array (
    0 => 'your.reverse.proxy.ip',
    1 => 'your.other.proxy.ip',
   ),

```

or issue occ command on host (iterating values 0, 1, 2…):

```auto
sudo nextcloud.occ config:system:set trusted_proxies 0 --value="your.reverse.proxy.ip"

```

Caution

Be aware that these values should be IPv4 or IPv6 addresses in [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation see [reverse proxy documentation](https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/reverse_proxy_configuration.html)

## Setting overwrite parameters

[Nextcloud overwrite parameters](https://docs.nextcloud.com/server/27/admin_manual/configuration_server/reverse_proxy_configuration.html#overwrite-parameters) such as `overwriteprotocol` and `overwritehost` are two configs that **absolutely** depend on your **reverse proxy** setup.

Be aware that some devices require an additional setting in `config.php` if your Nextcloud snap instance is behind a [reverse proxy](https://github.com/nextcloud-snap/nextcloud-snap/wiki/Putting-the-snap-behind-a-reverse-proxy#nginx-optional-custom-path-location-for-reverse-proxy).

> For internet facing Nextcloud snap that handles encryption itself or a pass-through reverse proxy is present it shouldn’t be necessary to set `overwriteprotocol` and `overwritehost`.

edit `config.php` and add/edit section

```auto
    'overwriteprotocol' => 'https',

```

```auto
    'overwritehost' => 'cloud.yourdomain.xyz',

```

or issue occ command on host:

```auto
sudo nextcloud.occ config:system:set overwriteprotocol --value="https"

```

```auto
sudo nextcloud.occ config:system:set overwritehost --value="cloud.yourdomain.xyz"

```

> **[Putting the snap behind a reverse proxy](https://github.com/nextcloud-snap/nextcloud-snap/wiki/Putting-the-snap-behind-a-reverse-proxy)**
>
> ☁️📦 Nextcloud packaged as a snap. Contribute to nextcloud-snap/nextcloud-snap development by creating an account on GitHub.

also be aware of correct FQDN settings

> **[Hosts and FQDN for Nextcloud snap](https://github.com/nextcloud-snap/nextcloud-snap/wiki/Hosts-and-FQDN-for-Nextcloud-snap)**
>
> ☁️📦 Nextcloud packaged as a snap. Contribute to nextcloud-snap/nextcloud-snap development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![VPSPioneer](https://help.nextcloud.com/user_avatar/help.nextcloud.com/vpspioneer/32/80251_2.png) [@VPSPioneer](https://help.nextcloud.com/u/VPSPioneer)\
**Post date:** [October 8, 2026, 11:56am UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/3 "2026-10-08T11:56:15Z")

</div>

Trusted domains won’t cause a cert name mismatch though, the TLS error happens before Nextcloud is even involved. Different browsers getting different certs for the same name usually means they’re not hitting the same listener.

Two quick checks on the VPS:

```auto
sudo ss -tlnp | grep ':443'
snap changes nextcloud

```

The first shows who is bound to 443 on IPv4 and IPv6. A common one is a server block that only has `listen 443 ssl;` without `listen [::]:443 ssl;`, so IPv6 clients fall through to the other subdomain’s block and get its cert. Chrome and Firefox don’t always pick the same address family, which would fit what you’re seeing. Also look for the snap’s own Apache on 443, it shouldn’t be there if nginx is in front.

The second shows whether the snap auto-refreshed around the time it broke. Snaps update on their own, and that’s usually the “no intervention” change on these setups.

You can compare both paths from anywhere with:

```auto
openssl s_client -connect subDomainB.domain.com:443 -servername subDomainB.domain.com -4 </dev/null 2>/dev/null | openssl x509 -noout -subject

```

and the same with `-6`.

---

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [October 8, 2026, 3:57pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/5 "2026-10-08T15:57:31Z")

</div>

> [@Ryan\_P](#):
>
> - The Snap was automatically refreshed.

yes, that it did see `snap info nextcloud`

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/6/f/6f9358d4e03fc2f5a569afe467cf54e5e54f697b.png)

@pachulo could you take a look if that has anything to do with ripping out certbot?  
[https://github.com/nextcloud-snap/nextcloud-snap/pull/3555](https://github.com/nextcloud-snap/nextcloud-snap/pull/3555)

@RGaskin how long has this instance been running? have you disabled the certbot service because you’re behind r-proxy?

This setup will assume that SSL termination and certificate management is handled by NGINX proxy manager.

The Nextcloud snap encryption and certificate renewal services may be [disabled](https://github.com/nextcloud-snap/nextcloud-snap/wiki/Managing-services#disable-nextcloud-snap-service).

- Stop and disable encryption:

```auto
sudo nextcloud.disable-https lets-encrypt

```

- Stop and disable certificate renewal service:

```auto
sudo snap stop --disable nextcloud.renew-certs

```

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_449c533f586939b6e5f246632a46421f.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [October 8, 2026, 6:28pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/6 "2026-10-08T18:28:55Z")

</div>

> [@Ryan\_P](#):
>
> Good luck, and feel free to share the Nginx configuration if you want another pair of eyes on it.

…or, if you want the hands that belong to those eyes to paste it into their preferred AI chatbot for you.

---

<div class="post-metadata">

**Author:** ![RGaskin](https://help.nextcloud.com/letter_avatar/rgaskin/32/6_449c533f586939b6e5f246632a46421f.png) [@RGaskin](https://help.nextcloud.com/u/RGaskin)\
**Post date:** [October 12, 2026, 11:20pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/7 "2026-10-12T23:20:52Z")

</div>

Many thanks to all three of you for diving in here to help. Much appreciated.

Was out for a while, and now that I’m back I’m eager to pick up where we left off, but there’s a lot of good guidance in this thread and not sure where to begin.

Here’s the output from _sudo nextcloud.occ config:list system_:

```auto
sudo nextcloud.occ config:list system
{
    "system": {
        "apps_paths": [
            {
                "path": "\/snap\/nextcloud\/current\/htdocs\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/snap\/nextcloud\/current\/nextcloud\/extra-apps",
                "url": "\/extra-apps",
                "writable": true
            }
        ],
        "supportedDatabases": [
            "mysql"
        ],
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "redis": {
            "host": " ***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "log_type": "file",
        "logfile": "\/var\/snap\/nextcloud\/current\/logs\/nextcloud.log",
        "logfilemode": 416,
        "maintenance_window_start": 1,
        "passwordsalt": " ***REMOVED SENSITIVE VALUE***",
        "secret": " ***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.MyDomain.com",
            "localhost",
            "nextcloud.local"
        ],
        "datadirectory": " ***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "34.0.4.1",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbname": " ***REMOVED SENSITIVE VALUE***",
        "dbhost": " ***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": " ***REMOVED SENSITIVE VALUE***",
        "dbpassword": " ***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": " ***REMOVED SENSITIVE VALUE***",
        "defaultapp": "linkboard,files",
        "mail_from_address": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": true,
        "mail_smtpname": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": " ***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "loglevel": 2,
        "mail_smtpsecure": "ssl",
        "theme": "",
        "overwriteprotocol": "https",
        "trusted_proxies": " ***REMOVED SENSITIVE VALUE***",
        "overwritehost": "cloud.MyDomain.com",
        "app_install_overwrite": []
    }
}

```

And here’s the Nginx file for the Snap subdomain:

```auto
server {

	listen 80;
	listen [::]:80;
	server_name cloud.MyDomain.com;
	return 301 https://$host:443$request_uri;
}

server {

	listen 443 ssl ;
	listen [::]:443 ssl ;
	server_name cloud.MyDomain.com;

	client_max_body_size 0;
	underscores_in_headers on;

	location ~ {
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		add_header Front-End-Https on;	

proxy_ssl_server_name on;
proxy_ssl_name $host;

		proxy_headers_hash_max_size 512;
		proxy_headers_hash_bucket_size 64;

		proxy_buffering off;
		proxy_redirect off;
		proxy_max_temp_file_size 0;
		proxy_pass http://127.0.0.1:81;
	}
}

```

What should my next step be?

---

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [October 13, 2026, 5:24am UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/8 "2026-10-13T05:24:51Z")

</div>

> [@RGaskin](#):
>
> What should my next step be?

I believe @VPSPioneer hit the nail on the head, start by removing v6 from the equasion:

> [@VPSPioneer](#):
>
> The first shows who is bound to 443 on IPv4 and IPv6. A common one is a server block that only has `listen 443 ssl;` without `listen [::]:443 ssl;`, so IPv6 clients fall through to the other subdomain’s block and get its cert. Chrome and Firefox don’t always pick the same address family, which would fit what you’re seeing. Also look for the snap’s own Apache on 443, it shouldn’t be there if nginx is in front.

---

<div class="post-metadata">

**Author:** ![RGaskin](https://help.nextcloud.com/letter_avatar/rgaskin/32/6_449c533f586939b6e5f246632a46421f.png) [@RGaskin](https://help.nextcloud.com/u/RGaskin)\
**Post date:** [October 14, 2026, 9:00pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/9 "2026-10-14T21:00:15Z")

</div>

I’m afraid I don’t understand. The listener in the NGinX server block already has the IPv6 SSL on 443. What am I missing?

---

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [October 15, 2026, 5:52am UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/10 "2026-10-15T05:52:49Z")

</div>

@RGaskin you’re not missing anything, simply remove the IPv6 block…

---

<div class="post-metadata">

**Author:** ![RGaskin](https://help.nextcloud.com/letter_avatar/rgaskin/32/6_449c533f586939b6e5f246632a46421f.png) [@RGaskin](https://help.nextcloud.com/u/RGaskin)\
**Post date:** [October 15, 2026, 2:46pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/11 "2026-10-15T14:46:13Z")

</div>

Still no go, I’m afraid. After simply removing the 443 block didn’t work, I also updated that Nginx file to change the 301 to “https://$host:444$request\_uri;” (it had been “https://$host:443$request\_uri;”). Also no go.

I’ve double-checked _sudo snap get nextcloud ports_, which show as expected:  
ports.http 81  
ports.https 444

But oddly, _sudo netstat -tulnp_ shows an IPv6 listener on port 81 but not 444, and no IPv4 listeners for either 81 or 444.

Is that a clue or a red herring?

```auto
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name    
tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN 549/systemd-resolve 
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 820/nginx: master p 
tcp 0 0 0.0.0.0:4488 0.0.0.0:* LISTEN 1/init              
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 820/nginx: master p 
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 549/systemd-resolve 
tcp6 0 0 :::443 :::* LISTEN 820/nginx: master p 
tcp6 0 0 :::4488 :::* LISTEN 1/init              
tcp6 0 0 :::80 :::* LISTEN 820/nginx: master p 
tcp6 0 0 :::81 :::* LISTEN 2390/httpd          
udp 0 0 127.0.0.54:53 0.0.0.0:* 549/systemd-resolve 
udp 0 0 127.0.0.53:53 0.0.0.0:* 549/systemd-resolve 
udp 0 0 209.159.149.146:68 0.0.0.0:* 672/systemd-network 
udp 0 0 127.0.0.1:323 0.0.0.0:* 845/chronyd         
udp6 0 0 ::1:323 :::* 845/chronyd        

```

For reference going forward, I’ve restored the Nginx file to the listing shown above in my earlier reply, which I had obtained from the cited tutorial. So any proposed changes can use that as a basis.

Also, I can’t help but wonder if “yanking certs from the Snap” may play a role here? I have another Nextcloud snap in my internal network that has been having trouble resolving its self-signed cert since about the same Snap update.

---

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [October 15, 2026, 2:57pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/12 "2026-10-15T14:57:15Z")

</div>

> [@RGaskin](#):
>
> Also, I can’t help but wonder if “yanking certs from the Snap” may play a role here?

nope, since you’re usin NGINX for TLS and it’ll be managing the certs, so the snap doesn’t do any cert stuff in your case. that can be disabled alltogether as mentioned above.

> [@RGaskin](#):
>
> But oddly, _sudo netstat -tulnp_ shows an IPv6 listener on port 81 but not 444, and no IPv4 listeners for either 81 or 444.

this does sound strange…  
did you tell the snap which ports it should use?

> **[GitHub - nextcloud-snap/nextcloud-snap: ☁️📦 Nextcloud packaged as a snap](https://github.com/nextcloud-snap/nextcloud-snap#httphttps-port-configuration)**
>
> ☁️📦 Nextcloud packaged as a snap

can you give us some more insight into yout reverse proxy setup?  
is that an NPM or plain nginx service?  
how did you install nginx?

---

<div class="post-metadata">

**Author:** ![RGaskin](https://help.nextcloud.com/letter_avatar/rgaskin/32/6_449c533f586939b6e5f246632a46421f.png) [@RGaskin](https://help.nextcloud.com/u/RGaskin)\
**Post date:** [October 15, 2026, 4:05pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/13 "2026-10-15T16:05:39Z")

</div>

> [@scubamuc](#):
>
> did you tell the snap which ports it should use?

Yes, using the example from the wiki at [Putting the snap behind a reverse proxy · nextcloud-snap/nextcloud-snap Wiki · GitHub](https://github.com/nextcloud-snap/nextcloud-snap/wiki/Putting-the-snap-behind-a-reverse-proxy)

```auto
sudo snap set nextcloud ports.http=81 ports.https=444

```

> [@scubamuc](#):
>
> can you give us some more insight into yout reverse proxy setup?  
> is that an NPM or plain nginx service?

Nginx alone.

> [@scubamuc](#):
>
> how did you install nginx?

I used:

```auto
sudo apt install nginx

```

Per the tutorial I started with: [Tutorial: Nextcloud snap with other services on the same server](https://www.nicemicro.com/tutorials/debian-snap-nextcloud.html#nginx-setup)

---

<div class="post-metadata">

**Author:** ![RGaskin](https://help.nextcloud.com/letter_avatar/rgaskin/32/6_449c533f586939b6e5f246632a46421f.png) [@RGaskin](https://help.nextcloud.com/u/RGaskin)\
**Post date:** [October 15, 2026, 5:53pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/14 "2026-10-15T17:53:05Z")

</div>

GOOD NEWS: per your earlier note about not needing the cert handling in the Snap, I double-checked how the certs are set up.

I was able to confirm I’d already removed the Snap cert with _sudo nextcloud.disable-https lets-encrypt_, so that much was good.

Then I ensured the cert for the Snap subdomain was in place with Nginx using: _sudo certbot --nginx -d [subdomainB.MyDomain.com](http://subdomainB.MyDomain.com)_

…and it noted that it already has a cert (seemingly good), and offered two options:

```auto
1: Attempt to reinstall this existing certificate
2: Renew & replace the certificate (may be subject to CA rate limits)

```

I chose option 1, and apparently the reinstall has resolved the issue.

I still don’t understand why the reinstall was needed, but I do have a much better understanding of current Snap cert setups in the current Snap config behind Nginx.

Thank you all for sharing your time and expertise.

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [October 23, 2026, 5:53pm UTC](https://help.nextcloud.com/t/snap-with-nginx-reverse-proxy/250603/15 "2026-10-23T17:53:25Z")

</div>

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.
