Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: subdomain question
PostPosted: Mon Jan 03, 2011 8:06 am 
Offline
Senior Newbie
User avatar

Joined: Mon Jan 03, 2011 7:43 am
Posts: 12
I have 2 ip address.

I want example.com use 173.x.x.x and files.example.com use 174.x.x.x.

Now example.com works well but files.example.com can't work.

Anyone help me? Thank you.
DNS Record(use Linode DNS):
Code:
A/AAAA Records
Hostname    IP Address    TTL             
                173.x.x.x        Default    
files                 174.x.x.x        Default    


I use debian5.0 32bit system。

ports.onf:
Code:
NameVirtualHost 173.x.x.x:80
NameVirtualHost 174.x.x.x:80
Listen 80
<IfModule mod_ssl.c>
 Listen 443
</IfModule>


sites-available/example.com:(This works fine)
Code:
<VirtualHost 173.x.x.x:80>
ServerAdmin admin@example.com
ServerName example.com
DocumentRoot /home/site1/public_html/
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
<Directory /home/site1/public_html>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>


sites-available/files.example.com:(This can't work)
Code:
<VirtualHost 174.x.x.x:80>
ServerAdmin admin@example.com
ServerName files.example.com
DocumentRoot /home/site1/public_html/files
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
</VirtualHost>


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 8:15 am 
Offline
Senior Member

Joined: Sun Aug 02, 2009 1:32 pm
Posts: 222
Website: https://www.barkerjr.net
Location: Connecticut, USA
You can only have one NameVirtualHost declaration. Use *:80

http://wiki.apache.org/httpd/CommonMisc ... iple_times.


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 8:31 am 
Offline
Senior Newbie
User avatar

Joined: Mon Jan 03, 2011 7:43 am
Posts: 12
An error occurred :
Code:
Reloading web server config:apache2[Mon Jan 03 07:22:35 2011] [warm] NameVirtualHost *:80 has no VirtualHosts.


Now I change example.com & files.example.com to:
Code:
<VirtualHost *:80>
ServerAdmin admin@example.com
..........
..........
</VirtualHost>


Is this right?


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 8:53 am 
Offline
Senior Member

Joined: Sun Aug 02, 2009 1:32 pm
Posts: 222
Website: https://www.barkerjr.net
Location: Connecticut, USA
Yes, that should work.


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 9:01 am 
Offline
Senior Newbie
User avatar

Joined: Mon Jan 03, 2011 7:43 am
Posts: 12
I have changed in my server.No error but files.example.com still not work

After this,I try to change ports.conf to
Code:
<IfModule mod_ssl.c>
 Listen 443
</IfModule>


example.com to
Code:
NameVirtualHost 173.x.x.x:80
Listen 80
<VirtualHost 173.x.x.x:80>
ServerAdmin admin@example.com
ServerName example.com
DocumentRoot /home/site1/public_html/
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
<Directory /home/site1/public_html>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>



files.example.com to
Code:
NameVirtualHost 174.x.x.x:8080
Listen 8080
<VirtualHost 174.x.x.x:8080>
ServerAdmin admin@example.com
ServerName files.example.com
DocumentRoot /home/site1/public_html/files
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
</VirtualHost>


but it's also not work.......


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 10:01 am 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
BarkerJr wrote:
You can only have one NameVirtualHost declaration. Use *:80

http://wiki.apache.org/httpd/CommonMisc ... iple_times.


That's a false statement. The problem is having identical NameVirtualHost statements, not multiple different ones.


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 10:07 am 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
What you want is this:

ports.conf:
Code:
NameVirtualHost 173.x.x.x:80
Listen 173.x.x.x:80

NameVirtualHost 174.x.x.x:80
Listen 174.x.x.x:80


And then both your sites-available as they were before. (Both should have a <VirtualHost IP_ADDRESS:PORT> line where IP_ADDRESS:PORT matches exactly to the NameVirtualHost line)

Then, make sure to enable both sites with a2ensite NAME.


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 10:26 am 
Offline
Senior Newbie
User avatar

Joined: Mon Jan 03, 2011 7:43 am
Posts: 12
thanks for your reply but it also has error meeage....
Code:
Starting web server:apache2(99)Cannot assign requested address:make_sock:could not bind to address 174.x.x.x:80
no listening sockets available,shutting down
Uable to open logs

ports.conf:
Code:
NameVirtualHost 173.x.x.x:80
Listen 173.x.x.x:80
NameVirtualHost 174.x.x.x:80
Listen 174.x.x.x:80
<IfModule mod_ssl.c>
 Listen 443
</IfModule>


example.com:
Code:
<VirtualHost 173.x.x.x:80>
ServerAdmin admin@example.com
ServerName example.com
DocumentRoot /home/site1/public_html/
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
<Directory /home/site1/public_html>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>


files.example.com:
Code:
<VirtualHost 174.x.x.x:80>
ServerAdmin admin@example.com
ServerName files.example.com
DocumentRoot /home/site1/public_html/files
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
</VirtualHost>


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 10:30 am 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
Ok, so I apparently fail at thinking early in the morning.

Delete the "Listen 173.x.x.x:80" line, and change the "Listen 174.x.x.x:80" to "Listen *:80"


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 10:46 am 
Offline
Senior Newbie
User avatar

Joined: Mon Jan 03, 2011 7:43 am
Posts: 12
also error。。。。
Code:
Retarting web server:apache2[Mon Jan 03 09:42:15 2011] [warn]NameVirtualHost *:80 has no VirtualHosts


ports.conf:
Code:
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
 Listen 443
</IfModule>


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 10:53 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
You are having problems.

Ok here's what you need

Listen *:80
NameVirtualHost *:80

Make sure you have no other Listen/NameVirtualHost directives anywhere else.

Then you need two virtual host configurations for

<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName files.example.com
DocumentRoot /home/site1/public_html/files
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
DocumentRoot /home/site1/public_html/
ErrorLog /home/site1/logs/error.log
CustomLog /home/site1/log/access.log combined
<Directory /home/site1/public_html>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>

You should also ensure you can ping both example.com and files.example.com

Lastly as hoopycat likes to say, "Please consider not redacting your host or domain name when asking questions." It would make things easier.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 11:11 am 
Offline
Senior Newbie
User avatar

Joined: Mon Jan 03, 2011 7:43 am
Posts: 12
According to your method,"files.wrust.me"still not work.But I find a question files.wrust.me can't pass ping.
Code:
Pinging wrust.me [173.230.152.x] with 32 bytes of data
Reply from 173.230.152.x: bytes=32 time=176ms TTL=52
Reply from 173.230.152.x: bytes=32 time=178ms TTL=52
Reply from 173.230.152.x: bytes=32 time=177ms TTL=52
Reply from 173.230.152.x: bytes=32 time=176ms TTL=52

Pinging files.wrust.me [173.230.156.xx] with 32 bytes of data:(This is the 174.x.x.x of the previous)
Request timed out.
Request timed out.
Request timed out.
Request timed out.


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 11:22 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
I bet either

1) You've not set up static networking according to this guide http://library.linode.com/networking/co ... nterfaces/

or 2) You've not rebooted after setting up the 2nd ip.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Mon Jan 03, 2011 11:30 am 
Offline
Senior Newbie
User avatar

Joined: Mon Jan 03, 2011 7:43 am
Posts: 12
Thank you.I forget to add "auto eth0 eth0:0 eth0:1" in /etc/network/interfaces.

Now It works.

Thanks again.


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


Who is online

Users browsing this forum: sjnorton and 7 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