1 Domain, 2 Subdomains, 2 servers, 3 IP addrsses, HELP!

Alles, was den Apache betrifft, kann hier besprochen werden.

1 Domain, 2 Subdomains, 2 servers, 3 IP addrsses, HELP!

Postby JoePostscript1 » 13. January 2017 17:33

I have a complicated set up, in over my head on this one. At a paid host I have an apache server on cpanel. DOMAIN.CLOUD dedicated IP address

So this one is pointed by registrar to nameservers of my host. That is all working good.

I have a second server at another site. It has 2 virtual host folders, 2 IP addresses, and each needs to be kept separate by IP and virtual host. I have my two virtual hosts SUB1, and SUB2 and have the virtual hosts working.. using port 80 and port 81 by IP address. ipaddress1:80 and ipaddress2:81 all works right.

But I need these both vhosts to resolve to the IP alone without the port.

(1) Get this IP address http://ipaddress1 resolving to the apache virtual host “SUB2” folder

THIS NEEDS TO RESOLVE BY IP ONLY TO THAT SUB2 virtual host folder
++++++++++++++++++
ipaddress2 connects (with) port ipaddress29:81 except it needs to connect to that folder without specifying the port, just the IP.
So this is the C:/www/SUB2
http://ipaddress2 = error, not same as :81, can’t subdomain yet
http://ipaddress2:81/ = ok

THIS IS GOOD:
++++++++++++++++++
Almost there.. OK ipaddress1 connects to port 80 without specifying it :80
so that is the C:/www/SUB1/public
http://ipaddress1 = same result, ready to subdomain
http://ipaddress1:80/ = same result

If I can get BOTH working by IP address without the port 80 & 81, the subdomain pointing will not work with the port on it, it has to be an IP address only.

Then I can point

DOMAIN.CLOUD - hosted server
SUB1.DOMAIN.CLOUD to ipaddress1 - remote server
SUB2.DOMAIN.CLOUD to ipaddress2 - remote server

2 Subdomains, 2 servers, 3 IP addrsses

When I try to edit the httpd.conf my server won't start and I have to revert the httpd.comf Its over my head and i am stumped hard.
JoePostscript1
 
Posts: 3
Joined: 13. January 2017 16:26
XAMPP version: 5.5.38
Operating System: Windows Server 2012 R2

Re: 1 Domain, 2 Subdomains, 2 servers, 3 IP addrsses, HELP!

Postby JJ_Tagy » 14. January 2017 01:41

If you don't use the standard port for http, you have to include it. There is no way around it.
JJ_Tagy
 
Posts: 722
Joined: 30. January 2012 13:44
Operating System: Windows 10 Pro x64

Re: 1 Domain, 2 Subdomains, 2 servers, 3 IP addrsses, HELP!

Postby Nobbie » 14. January 2017 13:08

A complete URL contains the protocoll (i.e. http:, ftp: etc.), it contains the Servername (i.e. a Domain like http://www.domain.com) or an IP, the Servername has to be followed by a colon and a Portnumber (i.e. http://www.domain.com:1234) and then the location of the requested file is appended. In same cases (ftp etc.) a Username:Password may be inserted between the protoll and the server (i.e. ftp://user:password@www.domain.com:21/folder/file.txt).

This is a fully qualified URL.

If you leave out any of these parts, certain default values are assumed. In your special case, if you apply http: as a protocoll and do NOT specify a Port, this is identically to specifying Port 80. Therefore, http://www.domain.com:80 and http://www.domain.com does mean EXACTLY the same URL. This is already analyzed and evaluated by the browser (there is still no Webserver involved), after then the browser sends a request to www.domain.com on Port 80. Therefore you CANNOT run a Webserver on Port 81 (or any different Port than 80) if you do not specify a Port in the URL. The Webserver does not receive the request.

What i finally dont understand: why are you running ipserver2 on a different Port than Port 80? From the technical view there is no need for Port 81, the different IP already is sufficient to differ between ipserver1 and ipserver2.
Nobbie
 
Posts: 9504
Joined: 09. March 2008 13:04

Re: 1 Domain, 2 Subdomains, 2 servers, 3 IP addrsses, HELP!

Postby JoePostscript1 » 16. January 2017 14:40

Thanks so much for taking the time to explain. Bless you brother I am so worn out with this thing trying to make it go. That is what I was reading but you explained the default port beautifully. The goal is to have the two subdomains working under the domain name correctly. Originally they were in same public_html folders, same IP, same host, same port. But I had to separate them, one needs .htaccess and the other needs it OFF, One needs diff php params in the php.ini than the other.

The fact is that its all one server. So, has 2 WAN IP, 2 vhosts. My thoughts is.. need to run different httpd.conf and php.ini. I really need an apache admin that can sort it all out but I'm on my own here. I am trying all kinds of stuff and just editing the httpd.conf I am having to revert back because whatever I try, apache won't restart.

SO, if the DNS won't allow me to put a port in there for a subdomain pointer. AND the use of :81 requires it be specified. You are saying that I should specify BOTH IP as port 80. ? Right?

But both IP are on same physical server. Port 80 has to point to one place, on a server.. right? So, then what, the httpd.conf and the vhost points each to their proper folder? If so, I am really having a hard time with my httpd.conf details making it come out correctly. But if this is the way, lets assume I cross that bridge.

Then how do I address the requirement that:

One requires .htaccess and the other requires it be disabled.
One requires different params in the php.ini file
JoePostscript1
 
Posts: 3
Joined: 13. January 2017 16:26
XAMPP version: 5.5.38
Operating System: Windows Server 2012 R2

Re: 1 Domain, 2 Subdomains, 2 servers, 3 IP addrsses, HELP!

Postby JoePostscript1 » 16. January 2017 14:52

<INPUT FROM A FRIEND:>
As I understood, you're wanting the "SUB2" site to respond on IP address http://ipaddress2 (without :81 port specification suffix).

To achieve that, nothing needs to be changed on the server. Instead, you should change mapping rules on your NAT. Currently, there is a rule on your NAT that maps port 80 of external IP address ipaddress2 to port 80 on internal IP LANipaddress. All you need is to change that rule so that it maps port 80 of ipaddress2 to port 81 on LANipaddress.
</INPUT FROM A FRIEND:>

Does that solve the domain, subdomain issue, So I can put that at the commercial host mapping the subdomains to these 2 IP addresses SUB1 and SUB2?
JoePostscript1
 
Posts: 3
Joined: 13. January 2017 16:26
XAMPP version: 5.5.38
Operating System: Windows Server 2012 R2

Re: 1 Domain, 2 Subdomains, 2 servers, 3 IP addrsses, HELP!

Postby Nobbie » 16. January 2017 15:03

INPUT FROM ME:

If you need help and ask for help here - why dont you give us the same full information as you provide to your FRIEND?? I cannot help (nobody can) you, if you do not provide all necessary information. You did not tell us anything about a router, a NAT, a portforwarding, a portmapping. How am I supposed to give advice about things, where i even do not know, whether these exist?

Basically, your friend is right, if your router can map different ports (some routers can, others cannot, you also did not tell us anything about your router), you can go that way what your friend told you. In that case you need the EXTERNAL(!) Port 81 in order to decide, which request has to go on which IP.

BUT: if all this happens on ONE PC only, you dont need two Apaches and two httpd.conf, it is BY FAR better to use VirtualHosts instead. You only need one WAN IP for that (there is no need for two IPs, neither WAN nor LAN), Apache decides to handle which request with the appropriate VirtualHost depending on the Servername (i.e. Domainname). This is the way you definately should go, if you only have ONE PC.
Nobbie
 
Posts: 9504
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 3 guests