Forwarding HTTP to HTTPS on Nextcloud


Recommended Posts

Hi. I am new to unraid.

I was wondering if there is a way to make it so that when I type in http and the ip address for unraid it forwards it to https and the ip address where nextcloud is. I want it so that if the ip of unraid is 192.168.1.10, when I type http://192.168.1.10 then the page automatically goes to https://192.168.1.10

 

I was trying to use port 80 with nextcloud, so I went into the "go" file in /flash/config/ in unraid and changed it so that the unraid webUI is using port 8000. Then I added port 80 to the docker container. Every time I try to reach the docker by going to "http://192.168.1.10" it forwards me to "https://_"  I have tried this with different apps, such as couchpotato and nextcloud, and have gotten the same result. Is it possible to change it so that when I type "http://192.168.1.10" it goes to "https://192.168.1.10" Or have it so that when I type in "http://192.168.1.10" it goes to the docker's web UI. Any help is appreciated.

Link to comment
  • 2 weeks later...

Hi,

 

Please post your system diagnostics.  These can be collected from the Tools > Diagnostics page inside the unRAID webGui.  In addition, if you could share your port mapping settings for the container(s) you've tried, that would be ideal.  It sounds like you have a container configured incorrectly with respect to port forwarding.

Link to comment

Sorry for the delay. I have linked my diagnostics and photos of my dockers for Nextcloud and Couchpotato. When I disable the docker in settings and type in http://192.168.1.10 then the browser says no DNS address was found. But when the docker is enable then it takes me to https://_ when nextcloud is stopped and couchpotato is running or vice versa. When both are stopped then it states no DNS address was found.

 

diagnostics-20170817-1438.zip

Containers.PNG

CouchPotato Container.PNG

Nextcloud Container.PNG

Link to comment

You can't run both containers at the same time as you can't have two webservers running on port 80

 

If you go to http://...... when neither container is running then you will get an error as there is no webserver running to respond to a request on http which is on port 80

 

Neither of the containers are running on the ip you're typing in which is http://192.168.1.10

 

The ip is http://192.168.1.211

 

I'm not intending to be rude here, so please don't take it so, but have you any experience with web/network setup, at the moment all I can see is a lot of poor configuration.

 

I have no idea why you want to run couchpotato on port 80 or Nextcloud on port 80 for that matter.

Link to comment

I have very little experience with network setups. I do type in http://192.168.1.211 to try and access nextcloud. I was just using http://192.168.1.10 as an example. I just want it where when I type http://192.168.1.211 it forwards me to https://192.168.1.211. I thought that if I used port 80 for nextcloud then nextcloud would forward me to port 443. But I was probably mistaken. This is how I had it configured on freenas where when I type http://192.168.1.2 it forwards me to https://192.168.1.2 where nextcloud was. When I run nextcloud I stop all of the other containers. Originally port 80 was only on nextcloud, so when I tried accessing nextcloud from http://192.168.1.211 it took me to https://_. Then I wanted to try a different docker so I downloaded couchpotato and turned off nextcloud and used port 80 in couchpotato to get the same result where it took me to https://_. So I assumed that since the same thing was happening in a different app then it had to do with something in unraid rather than nextcloud.

Link to comment

I got an ssl certificate from godaddy and I put the certificates in the keys folder in nextcloud. Then in /nextcloud/ngix/default I replaced the line "ssl_certificate /config/keys/cert.crt;" with "ssl_certificate /config/keys/nameofcertificate.crt;" and I replaced "ssl_certificate_key /config/keys/cert.key;" with "ssl_certificate_key /config/keys/nameofkey.key;". I did not touch any other file or line and restarted nextcloud, but now my domain and ip address wont connect to nextcloud. Was there something else I was supposed to do?

Link to comment
2 minutes ago, person said:

I got an ssl certificate from godaddy and I put the certificates in the keys folder in nextcloud. Then in /nextcloud/ngix/default I replaced the line "ssl_certificate /config/keys/cert.crt;" with "ssl_certificate /config/keys/nameofcertificate.crt;" and I replaced "ssl_certificate_key /config/keys/cert.key;" with "ssl_certificate_key /config/keys/nameofkey.key;". I did not touch any other file or line and restarted nextcloud, but now my domain and ip address wont connect to nextcloud. Was there something else I was supposed to do?

 

In all honesty, you're making all of this a lot more complicated than it needs to be.  Follow the guide I wrote and it will sort out your certificates and do everything you're after.  Setting up a webserver from scratch combined with trying to modify the config of a container that we recommend you run behind the LetsEncrypt container for good reason.

Link to comment
  • 2 weeks later...
On ‎19‎/‎08‎/‎2017 at 5:52 AM, person said:

I got an ssl certificate from godaddy and I put the certificates in the keys folder in nextcloud. Then in /nextcloud/ngix/default I replaced the line "ssl_certificate /config/keys/cert.crt;" with "ssl_certificate /config/keys/nameofcertificate.crt;" and I replaced "ssl_certificate_key /config/keys/cert.key;" with "ssl_certificate_key /config/keys/nameofkey.key;". I did not touch any other file or line and restarted nextcloud, but now my domain and ip address wont connect to nextcloud. Was there something else I was supposed to do?

I've been on a steep learning curve with dockers.  Thanks to CHBMB's guides and his dockers, (of which I am eternally gratefull) I am starting to get a good understanding of how this all works. Can I suggest you look at the nextcloud. mariadb and the letsencrypt dockers as a learning exercise.  CHBMB has a really good guide to marry them together. Letsencrypt  will get you free self renewing certificates as well as being a reverse proxy. It will direct the domain eg "cloud.domain.com" to the nextcloud server. Letsencrypt uses port 443.  Unfortunately so does MS Small business server. To make them live together turned out to be simple.  I pointed port 443 to the unraid server and added a file to the site-confs directory (the nextcloud file is in this directory as well) in letsencrypt which points to the SBS servers ip address on port 443.  I also added "remote," to the letsencrypt docker so the certificate recognised cloud.domain.com and remote.domain.com  Worked first go.  You can add other servers to the lets encrypt docker in a similar manner by creating the txt file in CHBMB's guide and adjusting the pointers to the program.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.