LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 01-01-2006, 10:24 PM   #1
arew264
Member
 
Registered: Jul 2005
Distribution: Arch Linux / Debian Etch (soon) / have tried many others
Posts: 94

Rep: Reputation: 15
Apache Virtualhosts and subdomains


I have a DNS server running on Debian linux that lets the computers on my network go to domain.com and connect to an apache2 server running on the same Debian box. I want to create the subdomain forum.domain.com, yet it does not work. I think I need to place a virtual host file in the /etc/apache2/enabled-hosts folder, yet this does not work. This is the default file in that folder that lets people connect when you install apache:
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/host/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

Here is the file I have been trying to get to work:

NameVirtualHost *
<VirtualHost forum.domain.com:80>
ServerAdmin (removed in the post to stop spam)

DocumentRoot /var/www/host/phpBB2/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/host/phpBB2>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access2.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

Last edited by arew264; 01-01-2006 at 10:28 PM.
 
Old 01-03-2006, 08:53 AM   #2
kbuk
LQ Newbie
 
Registered: Nov 2005
Location: London
Distribution: Debian
Posts: 17

Rep: Reputation: 0
ok for a start forum.domain.com is NOT a sub-domain (go have a look at a full dns manual / rfc for what a subdomain is. forum.domain.com is just a virtual host.

You'll need to add an A record for forum in the domain.com file in bind (or whatever dns server you're using).
Then make sure it resolves to your server.

Then create a regular virtual host eg

<VirtualHost ip_address : port>
Options ExecCGI Includes
DocumentRoot /path/to/files
ServerAdmin webmaster @ email.address
ServerName forum.domain.com
ScriptAlias /cgi-bin/ /path/to/cgi/bin/
ErrorLog /path/to/log/file
</VirtualHost>

The correct way is to create a file in the
/etc/apache2/sites-available then symlink it to /etc/apache2/sites-enabled

You'll probably want to specify the ip and port that the apache listens on
 
  


Reply


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 VirtualHosts and VSFTPd critical Linux - Software 3 09-14-2005 02:12 PM
Apache VirtualHosts Problem stratisphere Linux - Newbie 4 11-27-2004 12:20 AM
VirtualHosts & apache 2.0.48 TiCkO Linux - Networking 2 07-13-2004 03:20 PM
Apache + mod_ssl + virtualhosts problems rohypnol Linux - Networking 1 11-26-2003 12:48 PM
Virtualhosts in apache. where am i going wrong. SSBN Linux - Networking 20 07-11-2003 04:02 AM


All times are GMT -5. The time now is 09:15 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration