LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-07-2007, 04:28 PM   #1
mwecomputers
LQ Newbie
 
Registered: Jul 2007
Location: North Augusta, SC USA
Distribution: CentOS, RHEL, Scyld, Slackware, Solaris, SuSE, SLED, OpenSUSE
Posts: 20

Rep: Reputation: 0
Dynamic virthosts


Here is the issue.

We are working on giving our developers a 'sandbox' where they can create new sites under a base directory structure we have setup for them. The problem is the sites change from day to day, based on their site name and its a real issue for us to have to keep modifying the virthosts-sandbox.conf file for each site name change.

Listen 123.456.789.012:80
VirtualHost dev.mysite.com>
ServerName dev.mysite.com
DocumentRoot /web/sandbox.domainname.com/dev.mysite.com/htdocs
ErrorLog /var/web/sandbox.domainname.com/dev.mysite.com_error_log
CustomLog /var/web/sandbox.domainname.com/dev.mysite.com_access_log common
ScriptAlias /cgi-bin/ "/web/sandbox.domainname.com/dev.mysite.com/cgi-bin/"
<Directory /web/sandbox.domainname.com/dev.mysite.com>
Options Indexes FollowSymLinks Multiviews +Includes
AllowOverride All
</Directory>
</VirtualHost>


Is it possible to use the Rewrite Engine (or any other module) to just direct the site instead, based on what the DNS entry is seen as? Our DNS points each site to a CNAME like: sandbox.domainname.com

Example:
- dev.mysite.com would point to /web/sandbox.domainname.com/dev.mysite.com
- dev2.mysite.com would point to /web/sandbox.domainname.com/dev2.mysite.com

And so on.

We just don't want to have to keep modifying the virthosts-sandbox.conf for each new domain name being addressed. We are talking about several hundred sites found in the virthosts-sandbox.conf file, thus the reason for the request.

Apache Version: 2.0.52 (Red Hat)
PHP Version 5.1.2

Loaded Modules: core prefork http_core mod_so mod_access mod_auth mod_auth_anon mod_auth_dbm mod_auth_digest util_ldap mod_auth_ldap mod_include mod_log_config mod_env mod_mime_magic mod_cern_meta mod_expires mod_deflate mod_headers mod_usertrack mod_setenvif mod_mime mod_dav mod_status mod_autoindex mod_asis mod_info mod_dav_fs mod_vhost_alias mod_negotiation mod_dir mod_imap mod_actions mod_speling mod_userdir mod_alias mod_rewrite mod_proxy proxy_ftp proxy_http proxy_connect mod_cache mod_suexec mod_disk_cache mod_file_cache mod_mem_cache mod_cgi mod_php5 mod_ssl

-- Michael
 
Old 08-15-2007, 01:28 PM   #2
mwecomputers
LQ Newbie
 
Registered: Jul 2007
Location: North Augusta, SC USA
Distribution: CentOS, RHEL, Scyld, Slackware, Solaris, SuSE, SLED, OpenSUSE
Posts: 20

Original Poster
Rep: Reputation: 0
Smile

Solved the problem. I posted a similar message at forum.modrewrite.com and found out about mod_vhost_alias.

Here is the code I used to fix the problem:
Quote:
NameVirtualHost *:80
Listen 111.222.333.444:80

<VirtualHost *:80>
ServerName sandbox.domainname.com
DocumentRoot /web/sandbox.domainname.com
ErrorLog /var/web/sandbox.domainname.com/error_log
CustomLog /var/web/sandbox.domainname.com/access_log common
<Directory /web/sandbox.domainname.com>
Options Indexes +FollowSymLinks Multiviews +Includes
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAlias *
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/web/sandbox.domainname.com/sandbox.access_log vcommon
ErrorLog /var/web/sandbox.domainname.com/sandbox.error_log
VirtualDocumentRoot /web/sandbox.domainname.com/%0/htdocs
VirtualScriptAlias /web/sandbox.domainname.com/%0/cgi-bin
</VirtualHost>
-- Michael
 
  


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
Dynamic DNS exy123 Linux - Software 1 09-22-2005 01:25 AM
Getting Dynamic IP eponymous Linux - Networking 5 10-09-2004 06:08 PM
Dynamic name resolution for dynamic IP merlin740 Linux - Software 2 10-04-2004 05:56 PM
Dynamic IP? Gerardoj Linux - Networking 5 05-27-2003 02:20 PM
dynamic IP........ anoop_chandran Linux - General 4 11-25-2001 01:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:25 AM.

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