I'm running Nextcloud on a server, named myserver.com. The Apache server answers on port…
- User
I'm running Nextcloud on a server, named myserver.com. The Apache server answers on port 8080. I have a proxy in front. The external address to the Nextcloud server is https://mydomain.com. Now I need to change that address to https://mydomain.com/nc but I do not want to move the files on on the server myserver.com. I'm using Nginx Proxy Manager and hpw can I config that to allways show https://mydomain.com/nc in the client browser?
- Assistant
To configure Nginx Proxy Manager to always show https://mydomain.com/nc in the client browser while proxying Nextcloud on your server myserver.com, follow these steps:
- Open Nginx Proxy Manager in your web browser and log in.
- Click on "Proxies" in the left sidebar.
- Click the "Add Proxy Host" button.
- In the "Domain Names" field, enter "mydomain.com" (without quotes).
- In the "Scheme" section, select "https".
- In the "Forward Hostname/IP" field, enter the IP address or hostname of your Nextcloud server (myserver.com).
- In the "Forward Port" field, enter "8080".
- In the "Proxy Host" field, enter "/nc".
- Under the "Advanced" tab, enable the "Preserve Host Header" option.
- Leave the rest of the settings as their defaults or adjust them according to your requirements.
- Click the "Save" button to save the configuration.
Now, Nginx Proxy Manager will listen to requests for https://mydomain.com/nc and proxy them to your Nextcloud server running on myserver.com:8080. The client browser will always show the URL , even though the Nextcloud files are located on myserver.com.
- User
I do not have the "Preserve Host Header" as a choice - can I write it in the "Custom Nginx Configuration"?
- Assistant
Yes, you can add the necessary configuration to preserve the host header by using the "Custom Nginx Configuration" field in Nginx Proxy Manager. Here's how you can do it:
- Open Nginx Proxy Manager in your web browser and log in.
- Click on "Proxies" in the left sidebar.
- Click the "Add Proxy Host" button.
- In the "Domain Names" field, enter "mydomain.com" (without quotes).
- In the "Scheme" section, select "https".
- In the "Forward Hostname/IP" field, enter the IP address or hostname of your Nextcloud server (myserver.com).
- In the "Forward Port" field, enter "8080".
- In the "Proxy Host" field, enter "/nc".
- Scroll down to the "Custom Nginx Configuration" section.
- Add the following configuration to the "Custom Nginx Configuration" field:
codeproxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr;- Leave the rest of the settings as their defaults or adjust them according to your requirements.
- User
There are some error with the command to enter in “Custom Nginx Configuration” - can you write it again?
- Assistant
Certainly! Here's the corrected version of the configuration to be added in the "Custom Nginx Configuration" field in Nginx Proxy Manager:
plaintextproxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr;By adding the above configuration, you are instructing Nginx to set the necessary headers to preserve the original host header (remote_addr) from the client request.