Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Oct 17, 2012 5:41 am 
Offline
Newbie

Joined: Wed Oct 17, 2012 5:35 am
Posts: 2
I tried asking this question on stackoverflow, but it got ignored, so it might be something stupid.

I used the recommended Linode setup for Apache, but I was wondering if I can set the server external IP as a domain for testing.

On my Amazon server setup it works because all the domains point to the same folder.

Code:
    domain1.com - /var/www/domain1
    domain2.com - /var/www/domain2
    ex.ter.nal.ip - /var/www/


So I can use ex.ter.nal.ip/test for a testing website.

On my Linode setup I moved the folders inside the user directories

Code:
    domain1.com - /home/user1/public/domain1
    domain2.com - /home/user2/public/domain2
    ex.ter.nal.ip goes to domain2.com (I think it points to the last enabled site in Apache -a2ensite)


Is there a way to make it work?
I tried adding a vhost with <VirtualHost ex.ter.nal.ip> with the /home/test DocumentRoot, but then all the websites point to the test directory.

My domain vhost file looks like this:

Code:
    <VirtualHost *:80>
      ServerName  www.domain1.com
      ServerAlias domain1.com
   
      DirectoryIndex index.html index.php
      DocumentRoot /home/user1/public/domain1.com/public
   
      <Directory /home/user1/public/domain1.com/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
      </Directory>
    </VirtualHost>


My testing one looks lithe this, but when enabled all the domains point to the test folder

Code:
    <VirtualHost ex.ter.nal.ip>
      ServerName ex.ter.nal.ip
   
      DirectoryIndex index.html index.php
      DocumentRoot /home/test/public
   
      <Directory /home/test/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
      </Directory>
    </VirtualHost>


Top
   
PostPosted: Wed Oct 17, 2012 8:18 am 
Offline
Senior Member
User avatar

Joined: Fri Dec 11, 2009 7:09 pm
Posts: 168
Until someone who actually knows what they are doing comes along, you virtual domain is grabbing every incoming connection- "<VirtualHost *:80>". You need to specify that ip address as well.
I would question why you need/want to do this though- you can specify a virtual host for testing, and it will not be live until you change the name servers to point to it, but you can access is for testing by making an entry in your local hosts file.

_________________
--
Chris Bryant


Top
   
PostPosted: Wed Oct 17, 2012 9:02 am 
Offline
Newbie

Joined: Wed Oct 17, 2012 5:35 am
Posts: 2
And how can I do that?

I basically want to access something like 31.221.29.228/test and get to /home/test/public.
At the moment if I'm trying 31.221.29.228/test it goes to mydomain.com/test


Top
   
PostPosted: Wed Oct 17, 2012 9:11 am 
Offline
Senior Member
User avatar

Joined: Sat Apr 07, 2012 3:40 am
Posts: 56
Website: http://for-no-reason.net
Location: Australia
If you already have a domain you could use a subdomain along with your existing vhost. :) to me that's the easiest way i would do it.


Top
   
PostPosted: Wed Oct 17, 2012 2:45 pm 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Don't use <VirtualHost ip.ad.dr.here> at all - make them all <VirtualHost *:80>

The first <VirtualHost> block is used for all the accesses that don't match any of the ServerName/ServerAlias lines in any of the blocks - it's a catch-all.
If you're using the Debian-style sites-available directory, just name that one like 000test or __test or such, they're loaded in alphabetical order.

Personally, I think it looks very unprofessional to have the "catch all" address to display list of all sites, or tests, or any such stuff - it's just too easy for your customers to accidentally see it and complain.
Consider making it an empty vhost, a "business card" website, or such.
For testing, add another vhost - if you have your own domain use a subdomain of it, if you don't use something like testweb.private and add a line to your PC's hosts file pointing this name at the IP.

Also, Servername shouldn't have http:// in it.

Code:
#File 000catchall
<VirtualHost *:80>
      ServerName  liXX-yyy.members.linode.com
      #or
      #ServerName  your.own.domain.if.you.have.one
   
      DocumentRoot /var/www/businesscard
</VirtualHost>

#File test
<VirtualHost *:80>
      ServerName  test.your.own.domain
   
      DocumentRoot /var/www/test
</VirtualHost>

#File domain1.com
<VirtualHost *:80>
      ServerName  www.domain1.com
      ServerAlias domain1.com
   
      DocumentRoot /home/user1/public/domain1.com/public
</VirtualHost>

#File domain2.com
<VirtualHost *:80>
      ServerName  www.domain2.com
      ServerAlias domain2.com
   
      DocumentRoot /home/user2/public/domain2.com/public
</VirtualHost>

_________________
rsk, providing useless advice on the Internet since 2005.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group