Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-20-2010, 03:27 PM
|
#1
|
LQ Newbie
Registered: Dec 2009
Location: North Canton, OH
Distribution: Fedora
Posts: 13
Rep:
|
Best way to host 2 public servers from 1 external IP
I'm in the process of installing two virtual servers (Turnkey LAMP and Redmine appliances) and am wondering the best way to go about making both accessible through 1 external IP address. Is it possible to have both accessible from port 80 and redirect to the correct server? Or do I need to change the listening port for my repository?
I'm very frustrated with my web host and want to move my website to my own server until I can find/afford a suitable replacement, and my older brother and I need to have a private, internet accessible repository soon. I know changing the port is the most obvious solution, but we'd like to keep from having type specific ports if we don't need to.
EDIT: If anyone needs an example, I have both servers online. I have my lamp server in my routers port forwarding listed first, and so it seems to take over.
Current addresses:
http://www.animepwn.net - should point to a page that just says "www.animepwn.net" for now
http://lamp.stephansimon.net - should show the default webmin page
http://repo.stephansimon.net - loads webmin page instead.
Here are screens of my virtual host setup.
http://stephansimon.net/repo.png
http://stephansimon.net/lamp.png
I can also add the actual virtual host file contents if needed.
Last edited by firehak; 12-20-2010 at 09:36 PM.
Reason: added example
|
|
|
12-20-2010, 03:52 PM
|
#2
|
Senior Member
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125
|
If you are only hosting regular (http) web pages, Apache (LAMP) will support multiple of what are called virtual hosts on one IP address. The connection is established based upon the host name, eg site1.domain.com and site2.domain.com. I am not familiar with Redmine Appliances. If it also works on port 80, along with Apache, you may have some difficulties. If it works on a different port you will be fine.
|
|
|
12-20-2010, 04:03 PM
|
#3
|
LQ Newbie
Registered: Dec 2009
Location: North Canton, OH
Distribution: Fedora
Posts: 13
Original Poster
Rep:
|
Thank you for the quick reply, but I already know about and use virtual hosts for Apache. These are 2 separate servers. I have my LAMP stack to host my 2 domains, and then I want my separate Redmine installation to be on a sub domain without having to type repo.stephansimon.net:8080 if possible.
|
|
|
12-20-2010, 10:04 PM
|
#4
|
LQ Newbie
Registered: Dec 2009
Location: North Canton, OH
Distribution: Fedora
Posts: 13
Original Poster
Rep:
|
I read up on mod_proxy and still couldn't figure it out, so I've done it the easy way. I forwarded port 8080 to 80 for my repository server, and the lamp server has 2 virtual hosts to take control over the sub domain. The lamp server has 2 PHP files that just redirect with the header() function to right port. I would have liked to keep from showing ports in the URL, but.. this works too, I suppose. Marking solved.
|
|
|
12-22-2010, 06:26 AM
|
#5
|
Member
Registered: Jun 2007
Distribution: debian, ubuntu, centos, esxi
Posts: 39
Rep:
|
Quote:
Originally Posted by firehak
I read up on mod_proxy and still couldn't figure it out
|
you can have 2 separate web servers on 1 WAN IP using a "reverse proxy" both apache and squid can do this. By the sounds of it you've had a go with apache, perhaps try squid.
I've just set up a squid reverse proxy on the recomendation of some of the linux guys at work using a page from http://wiki.squid-cache.org/ConfigExamples such as this
The way I did it was with 3 servers, all virtual, to simplify the config on each server. You could probably keep it fairly simple with having squid on one of the servers but on a separate nic ip. A few key points for the setup are - The Wan IP port 80 forward to squid lan ip port 80
- which forwards to apache servers port 80
- squid machine resolves domain names to the lan ip addresses, set this in squid machine hosts file if your dns config doesn't allow this easy enough
some key squid.conf points are - http_port 80 vhost
- change "http_access deny all" to "http_access allow all"
- cache_peer lan.ip.of.server1 parent 80 0 no-query originserver name=server_1
- cache_peer_domain server_1 www.example.com example.com
- cache_peer lan.ip.of.server2 parent 80 0 no-query originserver name=server_2
- cache_peer_domain server_2 download.example.com alias2.example.net
a search around the net will often turn up config lines such as
httpd_accel_host virtual
httpd_accel_port 80 (the web server port)
httpd_accel_single_host off (It should be disabled when we are going to the reverse proxy for multiple servers)
httpd_accel_uses_host_header on
these are deprecated, but unfortunately show up in search results still
|
|
|
12-23-2010, 12:11 AM
|
#6
|
LQ Newbie
Registered: Dec 2009
Location: North Canton, OH
Distribution: Fedora
Posts: 13
Original Poster
Rep:
|
Thank you very much, beowulfnode! Something like that is EXACTLY what I was looking for! Both of my virtual servers were both Turnkey appliances using Apache like you guessed, but I was just trying the apache proxy modules. I've heard of the squid proxy before, but I didn't know it could be used as a reverse proxy. And, thanks for taking a peek even though my thread was marked as solved. I hate just using quick and dirty work arounds. I have no idea how long it will be before I decide to purchase web hosting again and I didn't like the idea of combining my repository server with my lamp stack just to avoid using port numbers in the URL.
|
|
|
All times are GMT -5. The time now is 05:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|