1.

Solve : Apache ??? Can you host 2 websites through same...?

Answer»

Hello ... I have a Celeron 700 Mhz Computer with 384MB Ram running Fedora Core 5 Linux, and set up as an Apache Web Server. The question I have is, can Apache serve two web sites at say 216.107.215.98:8080 and 216.107.215.98:8079, in which I have two registered domain names with DNS Forwarding through www.godaddy.com to 216.107.215.98:8080 and :8079 or can Apache only serve one port and website .... So I will have to have 2 computers running Apache one listening on port 8080 and the other on port 8079, with unique static IP's and port forwarding through my router?

Thanks for your assistance on this .... Its probably going to be where I will need to have 2 systems one listening on port 8080 and the other on 8079, but if I can serve two instances of Apache maybe, I'd rather have it all on the same server.

:-/Apache can indeed listen on multiple ports (and multiple IP addresses). Your NETWORK card can also have multiple IP addresses (within the same or different subnets).

For Apache, look up the "Listen" and "VirtualHost" directives in the manual, for more information.Thanks Rob ... I will look it up in their manual. Figured I would ask before looking. [smiley=thumbsup.gif]I host more than 2 websites with the following config at the end of my httpd.conf

Code: [Select]<VirtualHost nnn.nnn.nnn.nnn mmm.mmm.mmm.mmm>
ServerAlias www.domainname1.com domainname1.com
ServerName www.domainname1.com
DocumentRoot /WWW/directory1
</VirtualHost>

<VirtualHost nnn.nnn.nnn.nnn mmm.mmm.mmm.mmm>
ServerAlias www.domainname2.com domainname2.com www.domainname2.co.uk domainname2.co.uk
ServerName www.domainname2.com
DocumentRoot /WWW/directory2
</VirtualHost>
Note that domainname2 is setup so that you get exactly the same website regardless of whether you use a .com or .co.uk address (assuming you've registered both).Thanks banjo67xxx

Looked over your snippet and it looks like it would work if I was using 1 port for both sites such as the default 80 or 443. But since I am using DNS Forwarding to IP:port for my 2 websites at 8080 and 8079, would I also have to tell Apache to listen on 8080 and 8079, and if so on the line to tell Apache what port to listen on, would I put in SOMETHING like Listen on 8080:8079 to include both or would I have 2 separate lines,a nd if 2 separate lines hw does Apache differentiate between the two.

I will copy paste your snippet to my httpd.conf file and alter for my websites to see if this would fix it.

*** Maybe I should take the EASY way and run both sites through the same port, and point to 2 separate home pages like Index1.html and index2.html through my dns forwarding through my godaddy registered domain provider. BUT I think that Apache by defaukt is looking at Index.html as the home page.

I've not played around with listening on different ports. My broadband ISP only GAVE me one static IP, so my ADSL modem can only port forward everything for port 80 to a single port on my apache2 server (regardless of which domainname resolved to my static IP). I've left that as the default port 80 too.

I've listed multiple IPs in httpd.conf so that apache2 will work both from the internet and on my internal LAN (although its probably not necessary because of the NAT done by the ADSL modem when it port forwards). I then get DNS to work by running two sets of DNS servers, one set for my internal LAN which resolves my domainname to my internal LAN address of the apache2 server, and the other set which resolves my domainname to my static IP for the internet. I can only host one of the DNS servers for the external pair (and I get a friend to act as a secondary for me), by port forwarding port 53 to this host, and getting godaddy to register mine and my friend's static IPs as nameservers with ripe.

Hope this helps.It's still beyond me Dave, why you have to listen on anything other than the non-standard ports...



Discussion

No Comment Found