Delay when accessing sites on my server

I am trying to setup nginx and Letsencrypt on an Ubuntu VM runnning on my Windows 10 desktop. I am following this guide: http://tinyurl.com/y7zxg4jb

I got it to give me certs for all my subdomains but the guide is for subfolders, not subdomains. So how do I alter these sections for my subdomain sites:

Code:
# NZBGet
# location /nzbget {
#   proxy_pass http://127.0.0.1:6789;
#   proxy_set_header Host $host;
#   proxy_set_header X-Real-IP $remote_addr;
#   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# }
#
# Sonarr
# location /sonarr {
#    proxy_pass http://127.0.0.1:8989;
#    proxy_set_header Host $host;
#    proxy_set_header X-Real-IP $remote_addr;
#    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#  }
 
I am trying to setup nginx and Letsencrypt on an Ubuntu VM runnning on my Windows 10 desktop. I am following this guide: http://tinyurl.com/y7zxg4jb

I got it to give me certs for all my subdomains but the guide is for subfolders, not subdomains. So how do I alter these sections for my subdomain sites:

Code:
# NZBGet
# location /nzbget {
#   proxy_pass http://127.0.0.1:6789;
#   proxy_set_header Host $host;
#   proxy_set_header X-Real-IP $remote_addr;
#   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# }
#
# Sonarr
# location /sonarr {
#    proxy_pass http://127.0.0.1:8989;
#    proxy_set_header Host $host;
#    proxy_set_header X-Real-IP $remote_addr;
#    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#  }
If I understand your question correctly, isn't the answer in one of your older replies here?

https://hardforum.com/threads/delay-when-accessing-sites-on-my-server.1965642/#post-1043767067
 
If I understand your question correctly, isn't the answer in one of your older replies here?

https://hardforum.com/threads/delay-when-accessing-sites-on-my-server.1965642/#post-1043767067


The problem (I think) is that the previous system did things very differently. The new guide I am following puts everything in one file whereas the previous setup broke it up across 2-3. So I am not sure how to extrapolate the info and process it correctly. Plus the previous method was using the resolver section to get the container names to direct to them and I am assuming I can't use that anymore. This is where my ignorance on configuring nginx is really showing.
 
The problem (I think) is that the previous system did things very differently. The new guide I am following puts everything in one file whereas the previous setup broke it up across 2-3. So I am not sure how to extrapolate the info and process it correctly. Plus the previous method was using the resolver section to get the container names to direct to them and I am assuming I can't use that anymore. This is where my ignorance on configuring nginx is really showing.
The recommended way is to have a separate config file for each "site" in nginx. So, your previous method was typically what would be expected. You'll want to put the config files in the sites-enabled folder (going from memory on that, so do a quick double check on me before putting them there, I'm currently mobile) for each site or subdomain.
Can you explain more about why you assume you can't use the docker resolver? Are you setting it up with nginx outside of docker at this time? I couldn't make out if that's what you were trying at this point or not.
Don't worry about your ignorance. We are all ignorant until we accomplish projects like this and learn. Keep Google on hand and Google everything along the way as you go. Expect to find useful information in bits and pieces though. So, don't expect to find the whole guide that answers all your prayers. Try to Google each little bit of each step if you need to. So, something like "nginx configuration file for subdomain", then "nginx configuration file for website in docker container". Keep trying variations until you arrive at enough information that you can complete your own file.
 
You suggested that I try to setup nginx on a separate machine and not running it in Docker. That is what I am doing. I just assumed that since I am now running nginx outside that Docker environment that the resolver wouldn't work. I thought that was specific to their Letsencrypt/nginx Docker container. You say that the recommended way is a separate config for each site and I don't doubt you, but every tutorial I see does it differently and I do not know how to parse the info to combine different setups. I have been Googling all afternoon and this is where I am stuck. I have searched for the very string you suggest. Everything seems different and nobody's config looks the same as someone else's.
 
You suggested that I try to setup nginx on a separate machine and not running it in Docker. That is what I am doing. I just assumed that since I am now running nginx outside that Docker environment that the resolver wouldn't work. I thought that was specific to their Letsencrypt/nginx Docker container. You say that the recommended way is a separate config for each site and I don't doubt you, but every tutorial I see does it differently and I do not know how to parse the info to combine different setups. I have been Googling all afternoon and this is where I am stuck. I have searched for the very string you suggest. Everything seems different and nobody's config looks the same as someone else's.
No problem. If you're comfortable following that guide and putting everything in one config file, that works just fine.

Okay. Trying it outside of docker. Good idea. I believe you are correct in that you can't use docker's resolver from outside of a docker container/environment.

Remember, there is more than one way to skin a cat.

So, I believe your question is how to add subdomains to your nginx config file. Is that correct?
 
My question is how to add subdomains to the config in that guide which uses subfolders.
 
My question is how to add subdomains to the config in that guide which uses subfolders.
First, test if your docker containers are accessible from the expected port from the host OS. In Ubuntu terminal:
Code:
curl http://127.0.0.1:6789
 
That yields an error: Failed to connect... I think the issue is that 127.0.0.1 is the local host and does not host the NZBget (6789) container. The server that does host that has an IP of 192.168.1.42. If I try curl http://192.168.1.42:8096 I do not get an error, it just returns to to the command line.
 
That yields an error: Failed to connect... I think the issue is that 127.0.0.1 is the local host and does not host the NZBget (6789) container. The server that does host that has an IP of 192.168.1.42. If I try curl http://192.168.1.42:8096 I do not get an error, it just returns to to the command line.
Good that you realized that. So, use that in the configuration file that you do create.
Now, nginx has a cool feature for you. It will tell you if your config file(s) are correct or not. So, either way you choose to go about it (separate files, or one large config file), paste in what you had from your old config files and run the nginx test command.
Code:
nginx -t
If that comes back good, you should be good to restart the nginx service and see if you're in business or not....
 
I tried that and here is the response (can't copy and paste):

https://1drv.ms/u/s!AjVnhushK5VlgYwxKAfK-ffnO4sjWQ
s!AjVnhushK5VlgYwxKAfK-ffnO4sjWQ
 
Namecheap DNS servers suck ballz. Seriously. I had all kinds of issues with the forum I host when I was using their DNS servers. Once I switched it's been smooth sailing since.

You're best bet is to see if your ISP will give you a static public IP. Mine did for $5/month. If not find another DDNS provider and switch. You can still use namecheap as your registrar but get off their DNS servers ASAP.
 
Have you tried accessing the sites with FF/chrome in developer mode? Do it in a private tab after clearing your DNS cache. That should let you know the calls it's making, along with how long it's waiting for a response. That should at least give you an idea of where to investigate.


I'm running a similar setup at home, but without docker/nginx. Domain/DNS hosted on namecheap, with pfsense updating the DDNS (not that my IP has changed in a couple years now). No delays like what you notice, but I'm using a windows box as my WAP with ADFS in the backend for auth.
 
Namecheap DNS servers suck ballz. Seriously. I had all kinds of issues with the forum I host when I was using their DNS servers. Once I switched it's been smooth sailing since.

You're best bet is to see if your ISP will give you a static public IP. Mine did for $5/month. If not find another DDNS provider and switch. You can still use namecheap as your registrar but get off their DNS servers ASAP.


My ISP won't do static IPs for residential. How do you go about switch DDNS providers? Would I have to transfer out of Namecheap or something? Also, Namecheap has a Nameservers section under my domain and it is currently set to Namecheap BasicDNS. There is also a custom setting that when you select allows the entry of 2 nameservers. Can I just enter 8.8.8.8 and 8.8.4.4 and uses Google's or would these need to be different servers?
 
Have you tried accessing the sites with FF/chrome in developer mode? Do it in a private tab after clearing your DNS cache. That should let you know the calls it's making, along with how long it's waiting for a response. That should at least give you an idea of where to investigate.


I'm running a similar setup at home, but without docker/nginx. Domain/DNS hosted on namecheap, with pfsense updating the DDNS (not that my IP has changed in a couple years now). No delays like what you notice, but I'm using a windows box as my WAP with ADFS in the backend for auth.

Maybe I am doing something wrong, but I enabled Develope mode in Chrome and I don't see anything different and when you say private tab do you mean an incognito window in Chrome? Either way I tried what you said and I can't see where it shows the calls it's making.
 
Also, Namecheap has a Nameservers section under my domain and it is currently set to Namecheap BasicDNS. There is also a custom setting that when you select allows the entry of 2 nameservers. Can I just enter 8.8.8.8 and 8.8.4.4 and uses Google's or would these need to be different servers?
Yes, that's where you enter your nameservers. Personally I use cloudflares DNS servers.

henry.ns.cloudflare.com
leah.ns.cloudflare.com

When I was using a DDNS provider I used afraid.org and good luck with them.
 
Yes, that's where you enter your nameservers. Personally I use cloudflares DNS servers.

henry.ns.cloudflare.com
leah.ns.cloudflare.com

When I was using a DDNS provider I used afraid.org and good luck with them.

So I don't need to change DDNS providers, just change the nameserver on Namecheap? Why those addresses for Cloudflare. Aren't they 1.1.1.1 and 1.0.0.1?
 
What you use for your DDNS provider is up to you. After having issues with namecheaps DNS servers I'd be leary of their DDNS service. But that's just me.

The namesrever addresses were provided by cloudflare. 1.1.1.1 and 1.0.0.1 is the IP address of their public encrypted DNS servers.

You may need an account at cloudflare to use their nameservers. It's free to do so. I don't use any of their other services, just the nameservers.
 
What I was asking is if you say their DNS servers are not good, then does changing the nameserver in my account to, say Cloudflare's, fix the issue or is there more to it than that and I would need to change DDNS provider to get off Namecheap's DNS?
 
You just need to change DNS servers at namecheap. You don't have to change DDNS service to change the nameservers.

My point being namecheap DNS servers are crap and you should get off them before trying to resolve any connection issues you are having.
 
You just need to change DNS servers at namecheap. You don't have to change DDNS service to change the nameservers.

My point being namecheap DNS servers are crap and you should get off them before trying to resolve any connection issues you are having.

Got it. Thanks.
 
Jailer - That appears to have been the issue. I went to Cloudflare and created an account which gave me access to their nameservers. I then went to Namecheap and changed the nameservers to theirs an I haven't experienced the delay since. And have tried my sites probably about 150 times since then. Thanks so much!!
 
Back
Top