You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "V@dim" <va...@sacura.net> on 2004/02/02 22:12:43 UTC

[users@httpd] Apache + DNS

I configured DNS (bind9) and Apache in FreeBSD 4.7 (IP: 192.168.1.1).
My server name on FreeBSD - myserver.mydomain.com
This server configuration:

1. /etc/resolv.conf
   domain mydomain.com
   nameserver 192.168.1.1
   
2. Bind config:
   I have domain:
    mydomain.com
   This domain hosts:
    server    (192.168.1.1) - server and DNS-server (FreeBSD)
        site1    (192.168.1.1)
    site2    (192.168.1.1)
    xpcomp  (192.168.1.10)

3. Apache config (httpd.conf):

   NameVirtualHost myserver.mydomain.com

   <VirtualHost site1>
    ServerName site1.mydomain.com
    ServerAlias site1
    DocumentRoot /usr/local/proj/site1/html
    ErrorLog /usr/local/proj/site1/_log/error_log
    CustomLog /usr/local/proj/site1/_log/access_log common
   </VirtualHost>

FreeBSD is a Virtual Mashine (based on VMWare Workstation 4) under WinXP.
In Windows XP Lan config I wrote:
DNS -> 192.168.1.1.

My Computer settings:
  Name: xpcomp
  Workroup: MyWorkgroup
  DNS suffix: mydomain.com

When I in browser load my local site with url http://site1/ I want, that
browser automatically to the end of base url addes domain name in bind 
config.
Examples:
http://site1/ -> http://site1.mydomain.com
http://site1/test/index.html -> http://site1.mydomain.com/test/index.html

How can I make this think? What config i need to correct: apache, bind or
something another? (I can show my bind config files)


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache + DNS

Posted by "V@dim" <va...@sacura.net>.
Exist another method?

>
>The quickest way I can think of to do this is to have a separate virtual
>host for the short hostname, and use mod_rewrite:
>
><VirtualHost *:80>
>ServerName site1
>RewriteRule ^(/.*) http://%{SERVER_NAME}.mydomain.com$1
></VirtualHost>
>
><VirtualHost site1>
> ServerName site1.mydomain.com
>
> DocumentRoot /usr/local/proj/site1/html
> ErrorLog /usr/local/proj/site1/_log/error_log
> CustomLog /usr/local/proj/site1/_log/access_log common
></VirtualHost>
>
>If you get creative with RewriteCond, you should be able to do this in a
>single VirtualHost
>
>  
>
>>I configured DNS (bind9) and Apache in FreeBSD 4.7 (IP: 192.168.1.1). My
>>server name on FreeBSD - myserver.mydomain.com
>>This server configuration:
>>
>>1. /etc/resolv.conf
>>   domain mydomain.com
>>   nameserver 192.168.1.1
>>
>>2. Bind config:
>>   I have domain:
>>    mydomain.com
>>   This domain hosts:
>>    server    (192.168.1.1) - server and DNS-server (FreeBSD)
>>        site1    (192.168.1.1)
>>    site2    (192.168.1.1)
>>    xpcomp  (192.168.1.10)
>>
>>3. Apache config (httpd.conf):
>>
>>   NameVirtualHost myserver.mydomain.com
>>
>>   <VirtualHost site1>
>>    ServerName site1.mydomain.com
>>    ServerAlias site1
>>    DocumentRoot /usr/local/proj/site1/html
>>    ErrorLog /usr/local/proj/site1/_log/error_log
>>    CustomLog /usr/local/proj/site1/_log/access_log common
>>   </VirtualHost>
>>
>>FreeBSD is a Virtual Mashine (based on VMWare Workstation 4) under
>>WinXP. In Windows XP Lan config I wrote:
>>DNS -> 192.168.1.1.
>>
>>My Computer settings:
>>  Name: xpcomp
>>  Workroup: MyWorkgroup
>>  DNS suffix: mydomain.com
>>
>>When I in browser load my local site with url http://site1/ I want, that
>>browser automatically to the end of base url addes domain name in bind
>>config.
>>Examples:
>>http://site1/ -> http://site1.mydomain.com
>>http://site1/test/index.html ->
>>http://site1.mydomain.com/test/index.html
>>
>>How can I make this think? What config i need to correct: apache, bind
>>or something another? (I can show my bind config files)
>>
>>
>>---------------------------------------------------------------------
>>The official User-To-User support forum of the Apache HTTP Server
>>Project. See <URL:http://httpd.apache.org/userslist.html> for more info.
>>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>For additional commands, e-mail: users-help@httpd.apache.org
>>    
>>
>
>
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>
>  
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache + DNS

Posted by Tal Yardeni <ap...@tal-net.com>.

The quickest way I can think of to do this is to have a separate virtual
host for the short hostname, and use mod_rewrite:

<VirtualHost *:80>
ServerName site1
RewriteRule ^(/.*) http://%{SERVER_NAME}.mydomain.com$1
</VirtualHost>

<VirtualHost site1>
 ServerName site1.mydomain.com

 DocumentRoot /usr/local/proj/site1/html
 ErrorLog /usr/local/proj/site1/_log/error_log
 CustomLog /usr/local/proj/site1/_log/access_log common
</VirtualHost>

If you get creative with RewriteCond, you should be able to do this in a
single VirtualHost

>
> I configured DNS (bind9) and Apache in FreeBSD 4.7 (IP: 192.168.1.1). My
> server name on FreeBSD - myserver.mydomain.com
> This server configuration:
>
> 1. /etc/resolv.conf
>    domain mydomain.com
>    nameserver 192.168.1.1
>
> 2. Bind config:
>    I have domain:
>     mydomain.com
>    This domain hosts:
>     server    (192.168.1.1) - server and DNS-server (FreeBSD)
>         site1    (192.168.1.1)
>     site2    (192.168.1.1)
>     xpcomp  (192.168.1.10)
>
> 3. Apache config (httpd.conf):
>
>    NameVirtualHost myserver.mydomain.com
>
>    <VirtualHost site1>
>     ServerName site1.mydomain.com
>     ServerAlias site1
>     DocumentRoot /usr/local/proj/site1/html
>     ErrorLog /usr/local/proj/site1/_log/error_log
>     CustomLog /usr/local/proj/site1/_log/access_log common
>    </VirtualHost>
>
> FreeBSD is a Virtual Mashine (based on VMWare Workstation 4) under
> WinXP. In Windows XP Lan config I wrote:
> DNS -> 192.168.1.1.
>
> My Computer settings:
>   Name: xpcomp
>   Workroup: MyWorkgroup
>   DNS suffix: mydomain.com
>
> When I in browser load my local site with url http://site1/ I want, that
> browser automatically to the end of base url addes domain name in bind
> config.
> Examples:
> http://site1/ -> http://site1.mydomain.com
> http://site1/test/index.html ->
> http://site1.mydomain.com/test/index.html
>
> How can I make this think? What config i need to correct: apache, bind
> or something another? (I can show my bind config files)
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org