HOW-TO: Set up NGINX to reverse proxy your jails w/ Certbot

naq90

Dabbler
Joined
Jun 7, 2015
Messages
24
I'd like one of my jails to point directly at my domain like "www.website.com" without any backslashes or anything after ".com". How do I set up the conf file to do that?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Set up a server block with no forward that points to the document root of the jail.

Code:
server	{		
		listen	   80;
		server_name  Your domain name;
		root /usr/local/www/nginx;
		index index.html;
 

naq90

Dabbler
Joined
Jun 7, 2015
Messages
24
That worked! Thanks Jailer! I have another question for anybody in the thread: How do I set up the conf file if I want to use ssl on two separate domains? For instance, suppose I have two plugins. I'd like plugin A to go to www.pluginA.com and plugin B to www.pluginB.com both with SSL. Is this possible to do? Would I need to run another instance of nginx?
 

q_fleuren

Explorer
Joined
Jun 3, 2015
Messages
57
That worked! Thanks Jailer! I have another question for anybody in the thread: How do I set up the conf file if I want to use ssl on two separate domains? For instance, suppose I have two plugins. I'd like plugin A to go to www.pluginA.com and plugin B to www.pluginB.com both with SSL. Is this possible to do? Would I need to run another instance of nginx?

Code:
./letsencrypt-auto --debug certonly --standalone -d www.pluginA.com -d www.pluginB.com




Sub domains not included so
just add -d derp.pluginA.com -d pluginA.com so on so on ;)
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
How do I set up the conf file if I want to use ssl on two separate domains?
Just add a new server block with the information needed to forward to the jail in question. Your server name would be the domain and your would forward to the IP of the backend jail.
 

q_fleuren

Explorer
Joined
Jun 3, 2015
Messages
57
maybe something like this?
Code:
server {
  server_name www.pluginA.com;

  # app1 reverse proxy follow
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://x.x.x.100:80;

}

server {
  server_name www.pluginB.com;

  # app2 reverse proxy settings follow
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://x.x.x.100:80;
}



Proxy_pass IP HERE;
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Yup
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Sorry I have very little experience with ESXI so I can't help you there.
 

Bern

Cadet
Joined
Dec 29, 2016
Messages
6
First off, thanks for the great guide. Plexpy, SABnzbd, and Ombi took a little bit to get working, but it works perfect now!

One question, is there any reason why you have the cronjob to run every minute or am I misinterpreting it?

* 1 * * 1 ./certbot/letsencrypt-auto renew --pre-hook "service nginx stop" --post-hook "service nginx start"
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
First off, thanks for the great guide. Plexpy, SABnzbd, and Ombi took a little bit to get working, but it works perfect now!

One question, is there any reason why you have the cronjob to run every minute or am I misinterpreting it?

Actually you are right, there is no reason. My bad, thanks for pointing it out. Which guide did you follow for Ombi? i always end up with it not working anymore after a couple of weeks...
 

Bern

Cadet
Joined
Dec 29, 2016
Messages
6
@ZodiacUHD NP. As far as ombi (and most of the rest of my stack) I've found this guide to be the most straight forward and complete. I've actually added a few things to it so let me know if I can help with my limited tinkering :P
 

ricardomga

Cadet
Joined
Nov 22, 2017
Messages
2
Hello to all,
I am having troubles with nextcloud, i am trying to access it through mydomain.tld/cloud, already configures config.php and now i am having the following error "The page isn’t redirecting properly" i think i am missing something in the proxy config.
Any help would be realy preciated.
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Hello to all,
I am having troubles with nextcloud, i am trying to access it through mydomain.tld/cloud, already configures config.php and now i am having the following error "The page isn’t redirecting properly" i think i am missing something in the proxy config.
Any help would be realy preciated.
Hey, did you manually installed nextcloud or did you use the plugin?
 

Maxobus

Dabbler
Joined
Dec 9, 2017
Messages
15
I made everything step-by-step according to the Guide without any problem.

Installed Transmission as Plugin.
Then I tried to set up access to Transmission:

proxy_setup.conf
Code:
location /torrent {
	 proxy_pass http://192.168.1.10:9091;
	 proxy_redirect off;
	 proxy_set_header Host $host;
	 proxy_set_header X-Real-IP $remote_addr;
	 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	 }

Accessing to mydomain.com/torrent URL changes to https://mydomain.com/transmission/web/
and I get 404 Not Found.
If I go to mydomain.com, I see Nginx landing page, so it works.

After reading the whole thread, it looks like I need to change Base URL for Transmission.

But where it is? Or I'm doing something wrong?
 
Last edited:

supremicus

Dabbler
Joined
Dec 27, 2011
Messages
18

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Did you set up the base url for transmission itself? Do you access it via 192.168.1.10:9091/transmission or simply 192.168.1.10:9091?
 

Maxobus

Dabbler
Joined
Dec 9, 2017
Messages
15
Did you set up the base url for transmission itself? Do you access it via 192.168.1.10:9091/transmission or simply 192.168.1.10:9091?
I can access directly by 192.168.1.10:9091/transmission or simply 192.168.1.10:9091
The goal is to access it by mydomain.com/torrent

Where can I set up base URL for Transmission?
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
You can do it directly from the freenas GUI ( if you click on the left side under plugins-transmission). Otherwise you can edit the .json file.

Edit: i was wrong and it is not possible to change anything from the Freenas GUI.
 
Last edited:
Top