NAT woes

Hello all i have built a virtual machine in order to do my hosting so it is essentially NATed. I have frowarded port 10080 on the hypervisor to 80 on the VM with virtualmin installed. I have read alots of posts here an have messed about with my virtualmin setting, but have only managed to make things worse. In the begining i could get the it works page to appear for a virtualmin hosted site so i guess dns was ok but apache is not able to tell where to send things. However now all i get is a “server not found error” but not until it redirects me from to stripping the port number

So I am confused about things which ip do i need to be using it seems dns is correctly resolving to the external IP of the hypervisior. Just for full disclosure I am using external my own external DNS right now but do plan to move it to the virtualmin host soon so i have install DNS on this new host too could that be the issue?

I have this my setting in
system setting >> virtualmin configuration are
Network interface for virtual addresses = venet0
Default virtual server IP address = From network interface
Default IP address for DNS records = Automatically detect external address

In my /etc/apache/apache2.conf at the bottom i have this, and think i have tired them all but maybe not with the correct matching settings in the hosts files

Include the virtual host configurations:

Include sites-enabled/
NameVirtualHost *:80

Here is the relvant bits in my /etc/apache/sites-enabled

PS things work if i do a preview inside virtualmin

PPS i get this error when starting apache do i need to be setting the hostname somewhere I have tried using the ip address instead of but still not working!

Restarting web server: apache2apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName
… waiting apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName

As alway thank in advance for you help and such a fantastic product

All URLs you use must keep the :10080 bit, since you only forwarded that port on your external IP.

Apache itself though wouldn’t forward the URL from a :10080 one to one without port number, except you explicitly configure such a forward.

It’s probably the web site you installed there that’s doing that. If you’re using some CMS or Wiki or Blog software or so, check if the “base URL” or something similar is configured correctly.

The “Could not reliably determine” message can be safely ignored in your case. It means that Apache wasn’t able to reverse-resolve the IP address if your system into a hostname, which isn’t required though if the virtual hosts are set up correctly.

Aside from that, your explanation is a bit extensive, and I can’t really follow what the current remaining problem is exactly. :slight_smile: If the above doesn’t help, can you please re-phrase what exactly the current situation and problem is?

Hello and thanks for your reply

I agree and did not think apache would on its own forward from to I looked though and included below my /etc/apache/sites-enabled file. There does not seem to be anything there that would cause forwarding.

I am trying to setup a wordpress site, but do not want to make things anymore complicated than necessary, as i am not very familiar with the inner workings of wordpress. Therefore i have replaced the content of my public_html folder with one file index.html that contains this. however this may have caused more problems as the virtualmin preview does not work correctly anymore!

TEST HOST 1 It works!

This is the TEST web page for this server.

The web server software is running but no content has been added, yet.

I did this purly for troubleshooting but i am still getting page not found after being redirected to stripped port of coarse

Also when i did a preview using the the virtualmin preview service i get the default It works! page and not the newly created TEST HOST 1 It works! i was expecting.

Sorry for another extesive post but i guess i just that type of guy :slight_smile:

SuexecUserGroup “#1005” “#1005
DocumentRoot /home/testhost1/public_html
ErrorLog /var/log/virtualmin/testhost1.computerking.ca_error_log
CustomLog /var/log/virtualmin/testhost1.computerking.ca_access_log combined
ScriptAlias /cgi-bin/ /home/testhost1/cgi-bin/
ScriptAlias /awstats/ /home/testhost1/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/testhost1/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/testhost1/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/testhost1/fcgi-bin/php5.fcgi .php5

<Directory /home/testhost1/cgi-bin>
allow from all

RewriteEngine on
RewriteCond %{HTTP_HOST}
RewriteRule ^(.) [R]
RewriteCond %{HTTP_HOST}
RewriteRule ^(.
) [R]
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824

AuthName “ statistics”
AuthType Basic
AuthUserFile /home/testhost1/.awstats-htpasswd
require valid-user

Alias /dav /home/testhost1/public_html
<Location /dav>
DAV on
AuthType Basic
AuthName “”
AuthUserFile /home/testhost1/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
RewriteEngine off

I’m not 100% sure, but reasonably certain, that this is merely a matter of configuring the correct “base URL” in your Wordpress.

Try to access the URL “” to get to the control panel of Wordpress, then log in and check under “Settings / General”. There you can edit the base URL to add the port number.

If you can’t get to the admin panel using port 10080, you need to temporarily forward port 80, or access the server from directly in a LAN, without router.

As stated i have replaced the wordpress files in the public_html directory with this single file index.html
Can wordpress be affecting this virtual site still?? if so where would i look?? only has an index.html file now containing the below however this forum has stripped the html code from the below statement.

TEST HOST 1 It works! This is the TEST web page for this server. The web server software is running but no content has been added, yet.

NOTE this is the debian default /var/www/index.html file that is slightly modify so i can tell which site i am on.

Okay, I’m sorry but I still can’t really follow you what exactly the current problem is. Can you please reiterate that?

I’m also confused … :slight_smile: but I’ll give this a try anyways.

Q: I have frowarded port 10080 on the hypervisor to 80 !
A: Why? http protocol is 80 so why would you force the world to enter a url ending in 10080
Also I dont see what the hypervisor has to do with this. A hypervisor is a tool to be able to install 1 or more virtual machines. No more, no less.

Q: it seems dns is correctly resolving to the external IP of the hypervisior
A: Again what has the hypervisor to do with this? The Hypervisor don’t need an external IP unless you want to manage it from outside your location and once its running there is no need to manage a hypervisor.
You want your virtual machine to listen to your external IP which DNS seems to be correctly doing.
You want Apache to listen to your external IP when possible, e.g. you have a router that can actually route like in a datacenter.
I assume this is not the case so you want apache to listen to internal address like in LAN, for instance

Q: NameVirtualHost
A: So you are telling Apache to listen to port 80 on the external address and the world to send requests to port 10080
The reason you are trying this is that you have VMWare’s Zimbra running on the same IP, yes? However that is on a https

In my simple conclusion you have turned your virtual world upside down.
if you really need to access Zimbra from outside your location, then have that one listen to a different port like 10080
Leave apache to listen to port 80
You may want to make your internal address on the virtual machine for apache a DMZ in the router. So that all requests will be send to your virtual machine.
If your box is in a datacenter then only have Zimbra listen to another port.

hope that helps a little