PDA

View Full Version : [SOLVED] Apache Virtual Hosts behind NAT



MakOwner
August 18th, 2010, 11:31 PM
I'm wondering if this is even possible before I start the learning curve with Ubuntu and apache virtual hosts.

I have a static external IP address that resolves to the various domain names I will be using. I have a web server inside my network with a private IP address and any http request to the firewall is forwarded to the webserver on the appropriate port. This setup works well when using the same web page/configuration for all of the domains.

Will it be possible to use named virtual hosts in this configuration, or will the NAT'ing interfere?

Bachstelze
August 18th, 2010, 11:42 PM
Nope, the NAT doesn't matter, name-based virtual hosts will work fine.

MakOwner
August 19th, 2010, 02:00 AM
Nope, the NAT doesn't matter, name-based virtual hosts will work fine.

Thanks -- is there a tutorial for using virtual hosts with Ubuntu? Or at least some Ubuntu specific documentation? Everything about it I find on the web doesn't correspond to the configuration files I find in the Ubuntu install.


It's very confusing so far.

For example:

Following the apache2 docs at http://httpd.apache.org/docs/2.0/vhosts/name-based.html



For example, suppose that you are serving the domain www.domain.tld and you wish to add the virtual host www.otherdomain.tld, which points at the same IP address. Then you simply add the following to httpd.conf:


But there is no httpd.conf file in Ubuntu.
Why is it better to use a non-standard configuration setup?

Would these changes go in /etc/apache2/apache2.conf or in separate files in /etc/apache2/sites-available?
Putting them in files in /etc/apache2/sites-available isn't working for me...

Bachstelze
August 19th, 2010, 02:21 AM
After you create your file in sites-available, you need to do


sudo a2ensite <site_name>

and reload the apache config.

MakOwner
August 19th, 2010, 03:53 AM
After you create your file in sites-available, you need to do


sudo a2ensite <site_name>

and reload the apache config.

Does do anything more than create the link from sites-available/ to sites-enabled?

Bachstelze
August 19th, 2010, 05:37 AM
Does do anything more than create the link from sites-available/ to sites-enabled?

According to the man page, that's all it does. I can't tell for sure, though, it's in Perl, which I'm not very familiar with.

MakOwner
August 19th, 2010, 05:49 AM
According to the man page, that's all it does. I can't tell for sure, though, it's in Perl, which I'm not very familiar with.


That's all it does near as I can tell, too.
Manually creating the links has the same results, near as I can tell.

MakOwner
August 19th, 2010, 06:54 PM
I can't figure out how to change the status of this thread to solved, could a moderator update this please?

I (roughly) followed this process http://beginlinux.com/server_training/web-server/994-ubuntu-804-named-based-hosting (I'm not associated with them, just found them via google...) and set up virtual hosts in /etc/apache2/sites-available

I then added hosts entries in my DNS server inside the NAT's LAN for the various named servers to resolve all to the same IP.

External requests for the names servers through the NAT appliance (IPCop) returns the appropriate content.

arrrghhh
August 19th, 2010, 07:30 PM
I can't figure out how to change the status of this thread to solved

Glad it's sorted for ya. It's under the "Thread Tools" drop-down menu at the top of the page ;)

MakOwner
August 19th, 2010, 09:01 PM
Glad it's sorted for ya. It's under the "Thread Tools" drop-down menu at the top of the page ;)

Thanks!
Learn something new every day.