Solved

Apache2 Mass Hosting

Posted on 2004-04-12
3
310 Views
Last Modified: 2012-08-13
The question is valued at 500 points and here is what I need:

I know that a really nice mass-hosting can be organised using mod_rewrite and here is what I need:
1. We've got a file (/etc/vhosts) with this structure:

site1.net                              /home/user2
supersite2.org                      /home/bobby
mysite.de                            /home/anythingelse

so we've got a map with corresponding home dir where we'll find the "docs" folder (that has htdocs meaning) and "cgi-bin"

We're not discussing any log files here

What I need is to configure the apache to:
1. if the request is http://mywebhost.com/users/user2 - then use /home/user2 (if it''s not found - show the default server page - not any vhost)
2. if the request is http://site1.net look for the match in the /etc/vhosts and use /home/user2 (use the default server page if not found)

So I'll need the example part of the httpd.conf that lets me do the things like that for apache2

Hope that it's clear, will clarify if needed
0
Comment
Question by:advert2k2p
3 Comments
 
LVL 10

Accepted Solution

by:
Mercantilum earned 500 total points
Comment Utility
Using mod_rewrite

1. Ensure engine is on

RewriteEngine On

2. rule to actual users directories, e.g. user1, user2

RewriteRule  ^http://mywebhost.com/users/user1    http://site1.net   [L,R]    
RewriteRule  ^http://mywebhost.com/users/bobby   http://supersite2.org   [L,R]    

3. rule for other non existent users

RewriteRule  ^http://mywebhost.com/users/(.*)      http://mywebhost.com   [L]    

This should redirect user1 to site1.net, bobby to supersite2.org, and any other users/user to the home page (no redirect, same server).
The [L,R] means L: if match stop here (Last rule), R: redirect.
0
 
LVL 15

Expert Comment

by:periwinkle
Comment Utility
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

    ACCEPT: Mercantilum

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Periwinkle
EE Cleanup Volunteer
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now