Web Host Chat
Bringing Hosts & Customers together since 2001
Home QLinks Members Your Profile Register FAQ's Hosts Only Area SMS Alerts Advertising
User Information
»REGISTER NOW!

Go Back   Web Host Chat > Web Hosting Chat > Dedicated Servers, VPS and Colocation
Reply
 
LinkBack Thread Tools
Old 13th May 2008   #1 (permalink)
New User (2)
Brand New!
Join Date: May 2008
Posts: 2
Robo82 is on a distinguished road
Apache VirtualHost Problem

Hi,

I have an issue setting up some sites on the same server on the same doamin.

I'm using xampp on my server to set this up and have the domain http://preview.domain.co.uk which has its own lading page, but I also want to run an entire site from http://preview.domain.co.uk/play.

I thought from my config below I would be able to achieve this but when I go to http://preview.domain.co.uk/play I need to click onto index_site.php(which needs to be named like this) to access the site.

Please can anyone help.
Thanks

Code:
NameVirtualHost 127.0.0.1:80


	DocumentRoot C:/xampp/htdocs/
	ServerName preview.domain.co.uk
	ServerAdmin admin@preview.domain.co.uk



	DocumentRoot C:/xampp/htdocs/play/webroot
	ServerName preview.domain.co.uk
	ServerAdmin admin@preview.domain.co.uk
	
		Options Indexes FollowSymLinks
		AllowOverride All
		Order allow,deny
		Allow from all
		RewriteEngine on
		RewriteCond $1 !^(index_site\.php|lib|catalogue)
		RewriteRule ^(.*)$ /index_site.php/$1 [L]
	
__________________
Registered User
Robo82 is offline   Reply With Quote
Old 15th May 2008   #2 (permalink)
Trusted User (393)
Platinum User
Join Date: Jun 2006
Posts: 384
burble is on a distinguished road
Assuming you haven't fixed this yet, can you paste in the apache config as you have it, but without < > directives missing - use &lt; &gt; to escape them.
__________________
Registered User
burble is offline   Reply With Quote
Old 16th May 2008   #3 (permalink)
New User (2)
Brand New!
Join Date: May 2008
Posts: 2
Robo82 is on a distinguished road
Hi yeah still having issues, here is the config

Code:
NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
      DocumentRoot C:/xampp/htdocs/
      ServerName preview.domain.co.uk
      ServerAdmin admin@preview.domain.co.uk
</VirtualHost>

<VirtualHost preview.domain.co.uk>
      DocumentRoot C:/xampp/htdocs/play/webroot
      ServerName preview.domain.co.uk
      ServerAdmin admin@preview.domain.co.uk
      <Directory "C:/xampp/htdocs/play/webroot">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
            RewriteEngine on
            RewriteCond $1 !^(index_site\.php|lib|catalogue)
            RewriteRule ^(.*)$ /index_site.php/$1 [L]
      </Directory>
</VirtualHost>
__________________
Registered User
Robo82 is offline   Reply With Quote
Old 16th May 2008   #4 (permalink)
Trusted User (393)
Platinum User
Join Date: Jun 2006
Posts: 384
burble is on a distinguished road
Cool, thanks for that.

Basically you only want to use a virtualhost if it's a different domain (domain-play.co.uk) or a different subdomain (play.domain.co.uk), so you won't need to do that here.

From what you've said, there might be two things you're trying to do. You might just be trying to change the index file, or you might be trying to set up the play directory outside the main document root.

If you just want to give the play directory a different index file, change your config to:

Code:
# Bind to 127.0.0.1 port 80
NameVirtualHost 127.0.0.1:80

# Define virtual host; first one defined is the default,
# so this will catch http://127.0.0.1/ too
<VirtualHost preview.domain.co.uk>
      # Basic config for domain
      DocumentRoot C:/xampp/htdocs/
      ServerName preview.domain.co.uk
      ServerAdmin admin@preview.domain.co.uk
      
      # Ensure file system directory is allowed
      <Directory "C:/xampp/htdocs">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
      </Directory>
      
      #
      # Set the play directory to have a different index document
      # This is the important bit:
      #
      <Directory "C:/xampp/htdocs/play">
            DirectoryIndex index_site.php
      </Directory>
</VirtualHost>
However, if you want the play directory to be completely self-contained, ie contained in a directory other than the one in your DocumentRoot, you'll want to use the Alias directive:

Code:
# Starts as before:
NameVirtualHost 127.0.0.1:80
<VirtualHost preview.domain.co.uk>
      DocumentRoot C:/xampp/htdocs/
      ServerName preview.domain.co.uk
      ServerAdmin admin@preview.domain.co.uk
      <Directory "C:/xampp/htdocs">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
      </Directory>
      
      #
      # Set up an alias for the play directory
      # Note this path is outside the DocumentRoot
      #
      Alias play C:/xampp/play/htdocs
      
      # Set up play directory permissions
      <Directory "C:/xampp/play/htdocs">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
            
            # DirectoryIndex goes here
            DirectoryIndex index_site.php
      </Directory>
      
</VirtualHost>
Of course these configs aren't exhaustive, but they should point you in the right direction.

More details:
__________________
Registered User
burble is offline   Reply With Quote
Old 12th July 2008   #5 (permalink)
Registered User (8)
Welcome aboard!
Join Date: Jul 2008
Posts: 7
jamesapnic is on a distinguished road
I think what you want is this as the opening tag:

Quote:
VirtualHost *
This will bind the virtualhost to the one you have defined
NameVirtualHost 127.0.0.1:80

That directive is not for the site name

Quote:
ServerName preview.domain.co.uk
specifies that
__________________
James
E-Mail: james AT apnicsolutions.com Web: apnicservices.com
Management, Admin, Total Support, Shared, VPS, Dedicated
__________________
Registered User

Last edited by jamesapnic : 12th July 2008 at 02:38 AM.
jamesapnic is offline   Reply With Quote
Old 12th July 2008   #6 (permalink)
Trusted User (393)
Platinum User
Join Date: Jun 2006
Posts: 384
burble is on a distinguished road
Quote:
Originally Posted by jamesapnic View Post
I think what you want is this as the opening tag:



This will bind the virtualhost to the one you have defined
NameVirtualHost 127.0.0.1:80

That directive is not for the site name



specifies that
  1. Well spotted, that's what happens when I reply in a hurry
  2. To be pedantic, <VirtualHost *:80> would be best, safer if you want to add other ports later; specifying the IPs would be even better
  3. Seriously though jamesapnic, stop digging up dead threads - surely it is clear that the guy will either have fixed his problem in 2 months, or doesn't care any more?
__________________
Registered User
burble is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Netstat > Apache Web? andyb28 Business and Technical Advice 4 7th May 2008 05:03 AM
Apache and permissions TITAN Business and Technical Advice 21 19th October 2005 02:31 PM


Some great companies!


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0