2

I'm trying to setup a secondary Apache Server (will eventually become primary only).

The working setup was windows XP running Apache 2.2.6 (via Wampserver2) with 8 sites (virtual hosts), all working as expected. I want to upgrade to more modern applications. To this end I'm trying to convert (in my convoluted way) to a more recent box running Windows 7 on which I've installed Wampserver 2.5 and thus Apache 2.4.9. As a learning exercise I want to try getting both servers running together, whilst also maintaining all the current sites and it appears that using a gateway could allow this.

So what I currently have is Apache 2.2.6 on box A (local ip is 192.168.1.3) with the router (NB604N) forwarding ports 80,443, and 3306 to this box/ip, with various sites working fine (locally and externally).

I now also have Box B running Apache 2.4.9 with an ip address of 192.168.1.2. I've added a second site in addition to the original from the box (e:wamp/wwww), for this second site I've also setup a domain.

What I then did, on box A (apache 2.2.6) (what would be the gateway server) is to;

a) uncomment the mod_proxy modules as per :-

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
LoadModule headers_module modules/mod_headers.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule php5_module "H:/wamp/bin/php/php5.2.6/php5apache2_2.dll"

b) Added the following to the virtual hosts :-

<VirtualHost *:80>
    ServerAdmin [email protected]
    Servername www.mt.flnet.org
    ProxyPass / http://192.168.1.2/
    ProxyPassReverse / http://192.168.1.2
</VirtualHost>

I was actually surprised as the above was obviously sort of working from the outset (I was getting a 502 error but this appeared to be due to the trailing/final slash (/) which I eventually tried. By "sort of working" I meant that there was obviously some interaction as the 502 page (and later 403's) would display:-

  **Apache/2.4.9 (Win64) PHP/5.5.12 Server at 192.168.1.2 Port 80**

After getting over this hurdle (searching, reading and then trying quite a few things) and adding the / I then got the 403. I've also tried a number of changes since eg adding (to the gateway server, yep probably shouldn't be from all)

<Proxy *>
     Order Deny,Allow
    Allow from all
</Proxy> 

I've not changed much at all on box B other than to add virtual hosts for the WAMP installed site and another for the external test site (i.e. www.mt.flnet.org). Oh I did misread the Apache documentation and try to setup a forward proxy and have left the mod_proxy module loads uncommented (except balancing which I was pretty sure that I didn't want/need).

I've also changed the port forwarding to point port 80 to box B (192.168.1.2) and tests then worked ( Website Plus tests show OK rather than 403 and proxy.site displayed the expected page). Also if I change my hosts file (on a third local box) from

192.168.1.3 www.mt.flnet.org

to

192.168.1.2 www.mt.flnet.org

I don't get the 403.

My guess is that I'm relatively close and hopefully simply need to code the correct authority somewhere. What I don't really have a clue about is where. It would appear that it's the gateway that's denying the access as the error messages are in that gateway's log and also the origin server works fine if accessed directly.

I should say that I'm pretty inexperienced and just doing this mainly as a hobby, as I did originally back in 2007-2008 when I got box A running.

I would be very grateful if someone could point me in the right direction in regards to getting the gateway working.

1 Answer 1

0

I have managed to get this working. The last change I made was to add ProxyRequests Off and ProxyPreserveHost On to the virtual host configuration.

Additionally and prior to making the Proxyrequests and ProxyPreserveHost directives, I moved the ..... to the virtual host and also added location directives from (Pro Webmasters - How do I set up a “gateway” for a specific subdomain?). However, these changes didn't change the results. The virtual hosts configuration is now per:-

<VirtualHost *:80>
    ServerAdmin [email protected]
    Servername www.mt.flnet.org
    ProxyRequests     Off
    ProxyPreserveHost On
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
        ProxyPass / http://192.168.1.2/
        ProxyPassReverse / http://192.168.1.2
    <Location />
        Allow from all
    </Location>
</VirtualHost>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .