LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-14-2014, 09:46 AM   #1
virtualgeekz
LQ Newbie
 
Registered: Dec 2014
Posts: 2

Rep: Reputation: Disabled
Web server and separate mail server


Hi,

I have a simple server setup on my home network with a public IP. This server is running a simple Apache web server setup and is used to host my website. Since I have it registered to a public domain, I want to have a mail server setup as well, and I want (for some personal reason) this mail server to operate at another linux/machine server on the same network.

I know how to forward incoming request to this other machine going on the mail socket/ports (25, 110, 143 ect.), but I'd also like to have the port 80 (on a specific URL: mail.websiteaddress.com) to point to the specific machine on the local network.

How can this be set up in the apache files (or alternatively on the router)?
 
Old 12-14-2014, 10:55 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,344

Rep: Reputation: Disabled
If you have only one public IP address, you can only forward any given port to one internal host. However, some services can be proxied or forwarded at the application level, and as it happens, web traffic is one such service.

It works like this: One web server receives requests from external clients and, upon seeing requests for a specific site or directory, forwards that request to another, internal web server. The request is modified to match the domain and directory name of the internal server, and the response from that server is also modified before it is relayed to the client.

There are several web servers and dedicated proxy software that can handle this scenario, but since you're already using Apache, it would make sense to use the Apache module called mod_proxy to do this. According to the Apache documentation, you'll need to do something like this:
Code:
<VirtualHost *:80>
    ServerName mail.websiteaddress.com
    ProxyRequests off
    DocumentRoot /some/directory
    ProxyPreserveHost On
    <Location />
        ProxyPass http://webmail.internal-server.local/
        ProxyPassReverse http://webmail.internal-server.local/
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>
The web server must be able to resolve "webmail.internal-server.local" to the local (internal) IP address of the mail server for this to work.

(I actually just tried forwarding a subdirectory on a public web server running Apache to an internal web site, and it worked.)
 
Old 12-14-2014, 11:10 AM   #3
virtualgeekz
LQ Newbie
 
Registered: Dec 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks a lot!

Do you need a custom DNS setup on the main webserver to resolve a local URL? Or how do you do it in your setup?
 
Old 12-14-2014, 11:18 AM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,344

Rep: Reputation: Disabled
Quote:
Originally Posted by virtualgeekz View Post
Do you need a custom DNS setup on the main webserver to resolve a local URL? Or how do you do it in your setup?
My web server uses an internal DNS service for name resolution, but something as simple as an entry in the /etc/hosts file on the proxying web server will do the trick.
 
Old 03-26-2015, 11:05 AM   #5
linuxjsmithson
LQ Newbie
 
Registered: Feb 2015
Posts: 2

Rep: Reputation: Disabled
I've been using 1&1 for my custom email address. They actually took care of all the technical stuff so I've been free to work on my programming and web design. It definitely a luxury and I've been very happy with the service up to now. Problem solved!

Last edited by linuxjsmithson; 03-30-2015 at 02:08 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache web server and separate application server hydr8 Linux - Server 3 11-26-2014 01:54 AM
how to setup a LDAP server, mail server,web server on cent os srinath.proventus Linux - Server 4 11-03-2014 08:20 AM
How to monitor web server, FTP server, Mail server and database server vodka33us Programming 1 06-16-2008 04:20 AM
How the DNS-server is connected to work of a web-server and a mail-server? ukrainet Linux - Newbie 2 01-10-2005 09:18 PM
can we configure a Linux server with mail server,file server and web server kumarx Linux - Newbie 5 09-09-2004 06:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration