LinuxQuestions.org
Help answer threads with 0 replies.
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-03-2007, 01:56 PM   #1
garnetlion
LQ Newbie
 
Registered: May 2004
Location: Portland, OR
Distribution: Debian stable on server; Ubuntu Edgy on laptop and at work
Posts: 9

Rep: Reputation: 0
Subdomains where ServerName is an ip address


My workplace is setting up a dev box that will only be accessible from the local network, and we'd like to do different clients' sites on different subdomains. I swiped some rewrite conditions off the internet that I believe will get modrewrite all setup to forward subdomains to directories, and I believe it's working, but putting subdomains before the ipaddress doesn't work.

I think it's because it wants some sort of actual name for the box, but I'm not sure how to give it that. Obviously I'm not about to buy a TLD for it, putting the name of the box in the browser fails. I tried making up a domain name for it and putting that in my hosts file to resolve to the correct IP address, but that didn't work either. I suppose I could go into the DNS server and route traffic that way, but it seems like there's a more elegant solution.

I'm looking for any ideas you may have. Thanks.


PS - The swiped rewrite conditions:
ServerName big-ugly-box
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com
RewriteCond /var/www/%1 -d
RewriteRule ^(.*) /%1/$1 [L]
 
Old 12-04-2007, 11:16 AM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Quote:
Originally Posted by garnetlion View Post
[SNIP]Obviously I'm not about to buy a TLD for it, putting the name of the box in the browser fails. I tried making up a domain name for it and putting that in my hosts file to resolve to the correct IP address, but that didn't work either. I suppose I could go into the DNS server and route traffic that way, but it seems like there's a more elegant solution. [/SNIP]
For me, that is the "most elegant" solution. Think of it globally. You supply your own "private TLD" according to your DNS server for the system, then every system on your network can find it by using that "private TLD" which in reality could be anything, even a public TLD like google.com as long as the DNS resolves to your internal IP for *.google.com requests

Then, mod rewrite, redirects, and just about any other network service will work "as expected". Although, all of that isn't necessary as I think the IP should "work":
subdomain.192.168.1.1

Even though that "should" work, I think ideally and elegantly, using DNS to resolve to the machine is going to be the best long term way to accomplish the task at hand.

-Chad

Last edited by MasterC; 12-04-2007 at 11:37 AM.
 
Old 12-06-2007, 12:25 PM   #3
garnetlion
LQ Newbie
 
Registered: May 2004
Location: Portland, OR
Distribution: Debian stable on server; Ubuntu Edgy on laptop and at work
Posts: 9

Original Poster
Rep: Reputation: 0
Work's gotten crazy, so I've been pulled off that project, so I have no useful follow up. But I did want to thank you for your help, I anticipate it will be very useful when I get back to the issue next week.

Thanks again.
 
  


Reply

Tags
apache, modrewrite


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 ServerName Matir Linux - Software 2 08-12-2005 09:18 PM
defining servername as comps IP sherm Linux - Software 2 08-21-2004 05:32 PM
can't ping Apache by ServerName semesm Linux - Newbie 1 05-13-2004 04:32 PM
apache servername agfaread Linux - Newbie 0 07-01-2003 01:47 AM
appache servername illtbagu Linux - Software 8 02-26-2003 10:28 PM

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

All times are GMT -5. The time now is 10:02 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