Apache configuration vhost error

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

Apache configuration vhost error

Postby halex » 03. December 2012 20:10

Hello!

By 2 weeks I looking for the answer to a problem and still have not found an answer.
I have two physical servers and a single external IP 122.122.122.122
:Server 1 - 192.168.0.1 and Server 2 - 192.168.0.2
From 1 server runs the site test.com
On the second server I attempt to run the site abc.com, only fail to make it public.
On both servers I have installed xampp 1.7.4.
when I access abc.abc.com I get this error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, postmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

in xampp/apache/logs/error.log I get this message:
[warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
[warn] proxy: No protocol handler was valid for the URL /error/HTTP_INTERNAL_SERVER_ERROR.html.var. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

the file httpd-vhosts.conf from xampp\apache\conf\extra\ look like:

Listen 192.168.0.1:80
Listen 192.168.0.2:80
ServerName test.com

<VirtualHost 192.168.0.1:80>
ServerAdmin postmaster@test.localhost
DocumentRoot c:\xampp\htdocs\test.LOCALHOST
ServerName test.com
ServerAlias www.test.localhost
ErrorLog "logs/test.localhost-error.log"
CustomLog "logs/test.localhost-access.log" combined
</VirtualHost>


<VirtualHost 192.168.0.2:80>
ServerAdmin postmaster@abc.localhost
DocumentRoot "C:/xampp/htdocs/abc.localhost"
ServerName abc.com

ServerAlias www.abc.localhost
ErrorLog "logs/abc.localhost-error.log"
CustomLog "logs/abc.localhost-access.log" combined
</VirtualHost>

the router is set from Ip 192.168.0.1 to 122.122.122.122
and the httpd-vhosts.conf file above is from Server 1 (192.168.0.1)

If I was not clear enough, please ask

Please help me.
I am old searching for an answer

Hoping for a quick resolution.
Thank you in advance
halex
 
Posts: 5
Joined: 03. December 2012 19:46
XAMPP Version: 1.8.3-2
Operating System: Windows Server

Re: Apache configuration vhost error

Postby Nobbie » 03. December 2012 23:05

halex wrote:I have two physical servers and a single external IP 122.122.122.122
:Server 1 - 192.168.0.1 and Server 2 - 192.168.0.2


To keep it short; it is impossible to serve two different LAN IPs from one external IP. Thats all. The only way to serve two different IPs is to use different Ports.
Nobbie
 
Posts: 7017
Joined: 09. March 2008 13:04

Re: Apache configuration vhost error

Postby halex » 04. December 2012 07:51

Nobbie wrote:
halex wrote:I have two physical servers and a single external IP 122.122.122.122
:Server 1 - 192.168.0.1 and Server 2 - 192.168.0.2


To keep it short; it is impossible to serve two different LAN IPs from one external IP. Thats all. The only way to serve two different IPs is to use different Ports.


OKe.

Help me please whit configurations I have to do in order to succeed.

Thank you in advance
halex
 
Posts: 5
Joined: 03. December 2012 19:46
XAMPP Version: 1.8.3-2
Operating System: Windows Server

Re: Apache configuration vhost error

Postby Nobbie » 04. December 2012 10:46

a) lets take port 80 for PC 1 und port 81 for PC 2

b) configure your router to do a portforwarding Port 80 to PC 1 (i.e. 192.168.0.1) and another portforwarding to PC 2 (i.e. 192.168.0.2)

c) edit httpd,conf on PC 1 and insert

LISTEN 80

d) edit httpd.conf on PC 2 and insert

LISTEN 81

e) start both Apaches

Externel clients will reach PC 1 (or Server 1) by entering http://122.122.122.122:80 in their browser and Server 2 by entering http://122.122.122.122:81

As Port 80 is the default Port for HTTP, you may ommit the Port in URL, so clients may simply enter http://122.122.122.122 in order to reach Server 1. But for the Server 2, the Port 81 MUST be specified in any case.

Thats all, no need for virtual hosts. You need virtual hosts only if you wanna run two domains on ONE server (what is not the case, as you have to real different Servers).
Nobbie
 
Posts: 7017
Joined: 09. March 2008 13:04

Re: Apache configuration vhost error

Postby halex » 04. December 2012 12:04

I could not start the web site.

i configure my router to portforwarding from 192.168.0.2 to port 81 and 192.168.0.1 to port 80

in Server 2 I reinstall xampp, and in C:\xampp\apache\conf in file httpd.conf where i find
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80

i add
Listen 81
now my httpd.conf look like this:
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80
Listen 81

In my browser i typed 122.122.122.122:81 but nothing :cry: :cry:
halex
 
Posts: 5
Joined: 03. December 2012 19:46
XAMPP Version: 1.8.3-2
Operating System: Windows Server

Re: Apache configuration vhost error

Postby Nobbie » 04. December 2012 20:06

You should try from a different PC which is NOT inside the same LAN. Some routers cannot correctly redirect from/to the same LAN.

Inside your LAN, you should enter 192.168.0.2:81 into your browser instead - if the page display correctly, the problem is somewhere in your router and/or the port forwarding.
Nobbie
 
Posts: 7017
Joined: 09. March 2008 13:04

Re: Apache configuration vhost error

Postby Nobbie » 04. December 2012 20:08

Nobbie wrote:You should try from a different PC which is NOT inside the same LAN. Some routers cannot correctly redirect from/to the same LAN.

Inside your LAN, you should enter 192.168.0.2:81 into your browser instead - if the page display correctly, the problem is somewhere in your router and/or the port forwarding.


P.S.:

The

LISTEN 80

on the second Sever is completely useless - why did you apply that?
Nobbie
 
Posts: 7017
Joined: 09. March 2008 13:04

Re: Apache configuration vhost error

Postby halex » 11. December 2012 12:21

Finally I managed to solve the problem, now the website is online, but now I have another 2 problems:

1. To access the website, I need to write the name of the folder.If I access the website without the folder name not working
ex: www.test.com/joomla
Please give an opinion!

2. When accessing my site I see the external IP not the site name
Please give an opinion!
halex
 
Posts: 5
Joined: 03. December 2012 19:46
XAMPP Version: 1.8.3-2
Operating System: Windows Server

Re: Apache configuration vhost error

Postby Nobbie » 11. December 2012 19:17

Are you using Xampp?
Nobbie
 
Posts: 7017
Joined: 09. March 2008 13:04

Re: Apache configuration vhost error

Postby halex » 17. December 2012 07:33

Nobbie wrote:Are you using Xampp?


Yes
halex
 
Posts: 5
Joined: 03. December 2012 19:46
XAMPP Version: 1.8.3-2
Operating System: Windows Server

Re: Apache configuration vhost error

Postby Nobbie » 18. December 2012 13:17

Did you read readme_en.txt?

A quote from the readme:

A matter of security (A MUST READ!)

As mentioned before, XAMPP is not meant for production use but only for developers in a development environment. The way XAMPP is configured is to be open as possible and allowing the developer anything he/she wants. For development environments this is great but in a production environment it could be fatal. Here a list of missing security
in XAMPP:


If (and only if) you are a well educated Apache Administrator, you might use Xampp for Online Servers. But obviously you have no idea about configuring Apache, even not the most basic skills. You should not run a public server with Xampp but without any skill.
Nobbie
 
Posts: 7017
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 3 guests