logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Two Apache2 Web Server one Network
Author
torsten



Joined: 19 Jan 2014
Posts: 4
Location: usa

PostPosted: Sun 19 Jan '14 22:31    Post subject: Two Apache2 Web Server one Network Reply with quote

Hey Im new to this Forum.
I hope i Can find help her.

I have have Two Apache Webserver in One Network On one Static Ip. Both Apache Severs are installed on Ubuntu 12.04.
First Webserver Setup hostname apache, domain name test.com.
On this web server i Run My Website,Email, And 2 Php Webapps.
any thinks is working fine.

last night i setup a second separate(own pc) apache Server(ubuntu 12.04) as a Cloud Server.(own cloud) hostname cloud, domain name cloud.test.com
my question is how can access both server via port 80 from the world.
Right now i only can access Server 1 from the web.

I nat port 80 to both static lan adresses in the network.
I use (pfsense) for the router.

i try to reach my Second Server with cloud.test.com

I hope some can point me in the right direction.

Torsten
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Mon 20 Jan '14 9:14    Post subject: Reply with quote

Use VirtualHost instead.

If you want to run multiple Apache instances on same server you have to assign different IP for each instance, as there is no way to run two services on same port within single IP.
Back to top
torsten



Joined: 19 Jan 2014
Posts: 4
Location: usa

PostPosted: Mon 20 Jan '14 18:55    Post subject: Thank you for the fast Response Reply with quote

Thank you for you you response.
But i run 2 Separate Servers on 2 different lan ip addresses. But only 1 Static Ip. One Domain name.
First Server runs on Apache Virtual host.
Second Server Only Runs as cloud Server.

Thank you Torsten
Back to top
Anaksunaman



Joined: 19 Dec 2013
Posts: 54

PostPosted: Mon 20 Jan '14 23:31    Post subject: Two Apache2 Web Server one Network Reply with quote

What you need is a reverse proxy set up.

As I understand the function of pfsense (mostly as a firewall), it is unsuited to this task. If you are comfortable with a Linux environment (sounds like you might be), you may wish to investigate squid 3 or varnish.

If you want a quick and possibly slightly dirty solution, you can use Apache, though you will likely want to investigate mod_security. Basically, it blocks a large number of common exploits for web apps, etc. with regular expressions and a few rules. It is of course available for Linux, but the nice people here at Apache Lounge provide Windows based versions here as a download as well.

Official Site
http://www.modsecurity.org/download/

Apache Lounge compiled modules
http://www.apachelounge.com/download/

To use Apache for this in its most basic form (and certainly not to get in to possible security issues, etc.) you can set up something like the following to test things out:

1.) Make sure that you have a web-facing server (your proxy). Your web app server seems to be the candidate.

2.) Set up a virtual host on the Apache proxy for the domain you wish to forward:

Code:
<VirtualHost *:80>

ServerName cloud.test.com

#ServerAlias example.test.com

# We don't need this for basic proxying
#DocumentRoot "C:/example/path"

# In case we ever want to do a 301
#Redirect permanent / https://secure.example.com/

# security setting

ProxyRequests Off

# The two magic lines to redirect requests to the internal server, which is running Apache on port 80 as well.

# Proxy the root directory / to an internal ip of http://192.xxx.xxx.xxx/

ProxyPass / http://192.xxx.xxx.xxx/
ProxyPassReverse / http://192.xxx.xxx.xxx/

</VirtualHost>

This should be sufficient for testing. Again, note the the first slash is site root and the http://xxx.xxx.xxx.xxx is the internal ip of our catching server (e.g. not the proxy), as assigned by the network router. A trailing slash is generally a must to form URLs correctly. This setup makes it seem like when we go to cloud.test.com, we are accessing the web server but we are actually accessing the second pc (i.e. everything appears to work on port 80 through the browser).

Also remember that, again, these settings ignore pfsense, most security topics, and DNS bottlenecks (you will be fine if you host your own DNS, but something like URL forwards from a dynamic ip server could cause trouble for anything but the main page).

I guess I should mention you do need mod_proxy enabled for this to work, as well as mod_proxy_http. Wink

mod_proxy_html may solve some issues too, but isn't necessary for the basics.
Back to top
torsten



Joined: 19 Jan 2014
Posts: 4
Location: usa

PostPosted: Tue 21 Jan '14 4:12    Post subject: Two apache server Reply with quote

thank Anaksunaman for pointing in the right direction.

Thank you again for elat me in the right direction.


I looked into Varnish but negative it don't support ssl.
And i try squid3 via Pf Sense. but did work for me.

So I things Setup a New Ubuntu VM and install Nginx and try it.

Torsten
Back to top
torsten



Joined: 19 Jan 2014
Posts: 4
Location: usa

PostPosted: Tue 21 Jan '14 4:22    Post subject: quick and possibly slightly dirty solution(lol Reply with quote

Anaksunaman the Apache slotution works for me.

At least For the Time i can get my reverse Proxy Server Setup And working.


torsten
Back to top
Anaksunaman



Joined: 19 Dec 2013
Posts: 54

PostPosted: Tue 21 Jan '14 7:50    Post subject: Two Apache2 Web Server one Network Reply with quote

Glad to be of assistance. Very Happy
Back to top


Reply to topic   Topic: Two Apache2 Web Server one Network View previous topic :: View next topic
Post new topic   Forum Index -> Apache