LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 09-17-2012, 01:00 PM   #1
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 294

Rep: Reputation: 10
Wildcard Virtual hosting.


Code:
<VirtualHost *:80>
ServerName www.anishunix.com
ServerAlias anishunix
DocumentRoot "/usr/local/apache-tomcat-7.0.27/webapps/anishunix"
<Directory "/usr/local/apache-tomcat-7.0.27/webapps/anishunix">
DirectoryIndex index.jsp index.html
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
JkMount /anishunix* worker1
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/anishunix/.*\.(jpe?g|gif|png|css|js)
RewriteRule ^/$  http://www.anishunix.com/anishunix/ [R=302,L]
</VirtualHost>

This is my main domain virtual host configuration entry.

my requirement is going to host nearly 50 sub domains under this main domain. so i thought wildcard virtual hosting is good idea. please guide me to solve this thread.

main domain document root is /usr/local/apache-tomcat-7.0.27/webapps/anishunix


and the remaining 50 domains document root is /usr/local/apache-tomcat-7.0.27/webapps/anishunix/subdomains/

the same path for all subdomains.


please guide me to solve this thread. Thanks in Advance.


With Regards
Anish Kumar.V
 
Old 09-17-2012, 11:28 PM   #2
youcantoo_linuxguy
LQ Newbie
 
Registered: Oct 2006
Location: Lebanon, OR
Distribution: PCLinuxOS
Posts: 21

Rep: Reputation: 0
Quote:
Originally Posted by anishkumarv View Post
Code:
<VirtualHost *:80>
ServerName www.anishunix.com
ServerAlias anishunix
DocumentRoot "/usr/local/apache-tomcat-7.0.27/webapps/anishunix"
<Directory "/usr/local/apache-tomcat-7.0.27/webapps/anishunix">
DirectoryIndex index.jsp index.html
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
JkMount /anishunix* worker1
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/anishunix/.*\.(jpe?g|gif|png|css|js)
RewriteRule ^/$  http://www.anishunix.com/anishunix/ [R=302,L]
</VirtualHost>

This is my main domain virtual host configuration entry.

my requirement is going to host nearly 50 sub domains under this main domain. so i thought wildcard virtual hosting is good idea. please guide me to solve this thread.

main domain document root is /usr/local/apache-tomcat-7.0.27/webapps/anishunix


and the remaining 50 domains document root is /usr/local/apache-tomcat-7.0.27/webapps/anishunix/subdomains/

the same path for all subdomains.


please guide me to solve this thread. Thanks in Advance.


With Regards
Anish Kumar.V


Add this line before your main domain

################# Named VirtualHosts
NameVirtualHost *:80


After your main domain add these lines for each virtual domain

<VirtualHost *:80>
ServerName www.domain.tld
ServerPath /domain
DocumentRoot /web/domain
</VirtualHost>

repeat for each virtual domain.

after saving your httpd.conf file be sure to restart your web server. If you made any mistakes the server will refuse to start. Note it will tell you where the mistake is in the httpd.conf file.
 
Old 09-18-2012, 12:26 AM   #3
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 294

Original Poster
Rep: Reputation: 10
Hi bro,

i am asking about Wildcard virtual hosting , you are saying for normal virtual hosting. thanks for your reply.
 
Old 09-18-2012, 04:15 PM   #4
youcantoo_linuxguy
LQ Newbie
 
Registered: Oct 2006
Location: Lebanon, OR
Distribution: PCLinuxOS
Posts: 21

Rep: Reputation: 0
Quote:
Originally Posted by anishkumarv View Post
Hi bro,

i am asking about Wildcard virtual hosting , you are saying for normal virtual hosting. thanks for your reply.

OK so you are talking about something like this

NameVirtualHost 10.10.0.205

<VirtualHost 10.10.0.205>
ServerAlias *.test
VirtualDocumentRoot /var/www/%-3.0.%-2/test/%1/
CustomLog /var/log/apache2/access.log vhost_combined
</VirtualHost>

<VirtualHost 10.10.0.205>
ServerAlias *.dev
VirtualDocumentRoot /var/www/%-3.0.%-2/dev/%1/
CustomLog /var/log/apache2/access.log vhost_combined
</VirtualHost>
 
  


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
How to stop IP based hosting in virtual hosting deepak_message Linux - Server 7 08-19-2011 01:12 AM
Postfix Virtual Wildcard Subdomains aaronvegh Linux - Server 6 07-14-2011 05:52 PM
Apache with wildcard SSL and virtual host crispytwo Linux - Server 2 04-28-2009 08:56 PM
do I really need virtual hosting if only hosting one site kustomjs Linux - Server 8 05-22-2008 12:17 PM
Virtual Hosting marson Linux - General 2 12-28-2000 08:14 PM

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

All times are GMT -5. The time now is 12:11 PM.

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