Help a newbie with Nginx

SYSTEM INFORMATION
OS type and version Ubuntu Linux 20.04.4
Webmin version Webmin 1.994

Hello everyone, I am very new to the whole Webmaster space, I recently spun up a webserver running Ubuntu 20.04.4, with Virtualmin/Webmin to do some playing/testing around with. I seem to be having a really hard time trying to figure out how to do the reverse proxy on Nginx, can’t even seem to figure out how to redirect the subdomain I created to the 10000 port for webmin. If anyone can help me out, or give me a link to some good tutorials, I would greatly apreciate it, all I can find on YouTube are some really old videos.

Thank you in advanced.

Hello @Misinthe and welcome to the community.

From your comment about redirecting to port 10000, I can infer that you have not started off with Virtualmin via the automated installer.

You must install Virtualmin on a freshly installed system (with nothing else installed except the OS) and then follow the instructions here:

Automated Virtualmin Installation – Virtualmin.

After you do this, Webmin and Virtualmin will be installed on your system.

Thereafter you will use Virtualmin (and not Webmin) to host domains by creating virtual servers - one virtual server per domain. All redirection to port 10000 etc will be configured automatically by Virtualmin when you create a virtual server / domain.

Feel free to reach out to the community via this forum if you need assistance or information.

1 Like

Hello @calport , thank you for your response.

I have Virtualmin installed on the Server together with Nginx and Webmin. Currently to get to Virtualmin, I have to go to https://192,168,0,100:10000.

What I want is, let’s say I have my domain that is www,example,com, and I created a subdomain named webhost,example,com.
If I go to either example,com:10000, or webhost,example,com:10000, I can get to the Virtualmin log in page. I want to make it where webhost.example.com will automatically redirect to the Virtualmin port 10000, and then create another Virtual Server for www,example,com, where it will redirect port 80/443 to.

This is where I thought I had to configure that, which is in the Webmin part of the server.

Again, I appreciate any help I can get! I’ve been stuck for months.

Important: the hostname for a Virtualmin system must be a subdomain - if you wish to use webhost.domain.tld then that’s fine and I assume you have configured this as hostname, ideally before you installed Virtualmin.

If you want your website to be www.domain.tld then the simplest way to do so is to create a virtual server in Virtualmin for domain.tld.

Not Webmin. Virtualmin does the redirection of port 10000 for you automatically and by default. For every client domain that you host on a Virtualmin system, port 10000 is accessible via admin.clientdomain.tld.

Now, if the DNS for clientdomain.tld is handled by Virtualmin’s DNS then the appropriate DNS records for admin.clientdomain.tld and webmail.clientdomain.tld (that’s port 20000, yay!) are automatically created when you create the virtual server in Virtualmin. However if the DNS for clientdomain.tld is handled external to Virtualmin, by a third party DNS service, then you will have to manually create A records (and AAAA records) for the subdomains admin, webmail, mail etc. via the control panel of the third party DNS service. If you do this for one or more domains hosted on a Virtualmin system, then everything else is configured automatically, you need not do anything about it in Webmin.

It just works. Enjoy!

1 Like

Well, that seems pretty simple enough. So right now, I only have 1 Virtual Server that was created during the Initial process for the webhost,domain,com. I have not touched any other configuration.

When I go to either webhost,domain,com or domain,com, I get this page.

Well begun is half done. :+1:

To check how things stand, could you visit admin.domain.tld and admin.webhost.domain.tld and report to us what you see?

Good morning,

So, when I go to admin.domain.tld, I get the same page that says “Under Construction”, and when I go to admin.webhost.domain.tld I get this error page.

Hmm. This indicates a problem either with the DNS records of the domain or the values you have entered in Virtualmin’s post install wizard.

How do you manage DNS for domain.tld (your own domain). Do you use Virtualmin DNS at all? Do you have a test domain that can be pointed to Virtualmin’s DNS servers to check if it resolves as it should?

No sir, I manage them with bluehost, since that’s where the website used to be hosted, I stopped the host service because I want to do it myself, but I still have my domains with them. This is how the DNS servers are on the domain right now. This is not a live website, so we can do any testing you want, it doesn’t really matter to me, this is just a personal project for me.

image

That’s great, let’s see if we can’t get the admin and webmail subdomains to redirect to ports 10000 and 20000 respectively.

See

And also

Good morning @calport , when you talk about the 5 domains to add to the A Records, I had already configured the following.
domain,com
www,domain,com
mail,domain,com
admin,domain,com
webhost,domain,com
www,webhost,domain,com
vpn,domain,com

I just have a couple of questions, when you say in the example, set the name servers to ns1,domain,com, do you mean add an A record or change the DNS Name Server that I should you above to the domain? Also, I think DNS records are a little complicated on BlueHost, is there a provider that works better with Virtualmin DNS? I am always open to changing whatever is needed to make it easier on myself.

Thank you

Change the A record is what I mean. If you do so, you could use your vanity nameservers on other domains that you may wish to host on your Virtualmin system.

Your question is flawed.

Virtualmin is a DNS provider or you are, actually, as owner of a Virtualmin system. Once you set up ns1 and ns2 correctly on Virtualmin (as part of the post-install wizard), all the operations that you are doing in the BlueHost control panel with regard to setting A records etc, your clients will be doing on your Virtualmin system for their domains.

Virtualmin has its own DNS server and it can be used as authoritative for all the domains that you host on your Virtualmin system.

To keep things simple at the beginning, point ns1 and ns2 to the Virtualmin IP, enter those as name servers in the post install wizard and specify ns1.domain.tld and ns2.domain.tld as nameserver for all other domains that you wish to host on your Virtualmin system except domain.tld. Leave domain.tld nameserver with BlueHost for now.

I understand, that is awesome that Virtualmin can do that. It’s much more feature rich than I thought.
I have changed the DNS records to ns1,domain,com and ns2,domain,com. I’m taking the kids to the waterpark while the DNS propagates. What should I test when I come back to make sure it is working? Thank you.

If it works, you will see the Virtualmin under construction page when you visit the URL.

Have fun with the kids!

Wouldn’t you need 2 VM’s to run your own, also how is secondary name server setup in VM?
P.S. I just read the FAQ http://www.virtualmin.com/documentation/dns/faq/
Ok I alway thought NS2 (secondary) read what was in NS1 (primary) and was a backup on another server. the FAQ seems to say NS1 and NS2 are the same domain name server.

You are right, @stefan1959. That’s the way it is supposed to be and that’s the way it was back in the day when we would put ns2 on another server which was on another network from ns1, so that redundancy was built into the design of the ecosystem.

But we have since then broken the internet and deviated from standards in so many ways. This is one of them: ns1 and ns2 can now be on the same vps. :slight_smile:

Are you using the same IP, or have you allocated 2 ips?

Same IP for everything.

Just add it in the box below the one for the primary name server in the post install wizard. That’s all there is to it.