Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Oct 09, 2010 5:47 pm 
Offline
Newbie

Joined: Fri Oct 08, 2010 12:43 pm
Posts: 2
Website: http://www.chiringapress.com
Location: Texas
We're having trouble with 1 out of 7 virtualhost configurations: trying to get http://example.com to resolve to http://www.example.com.


We have 7 domains setup in linode, DNS records all configured the same, with A/AAAA records all pointing to the same linode (same IP). The DNS record is set up for the domain without www. prefix.

The linode is running Ubantu 9.1.

There are virtualhost files for all 7 domains in /apache2/sites-available, and all have been enabled via a2ensite.

Here is a template of the virtualhost file from sites-enabled, where "example" is replaced with the domain name. All sites have the same DocumentRoot (drupal multisite install).

The http://example.com-> http://www.example.com rollover is working of 6 out of the 7 domains so configured. The question, what might be the problem with the 1 that won't behave?

<virtualhost *:80>

# Admin email, Server Name (domain name) and any alias
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com

# Index file and Document Root (where the public files are located)

DirectoryIndex index.html index.php
DocumentRoot /var/www/webroot

<Directory /var/www/webroot/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^/(.*) http://www.%{HTTP_HOST}:%{SERVER_PORT}/$1 [L,R]

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

#Drupal
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

# Custom log file locations
LogLevel warn
ErrorLog /var/log/example/error.log
CustomLog /var/log/example/access.log combined

</virtualhost>

I tried deleting an recreating the DNS record.
I tried adissite disabling the site (it becomes unavailable), then reenabling (aensite) (it becomes available).

Where might I look for clues?
Thanks!


Top
   
PostPosted: Sat Oct 09, 2010 7:48 pm 
Offline
Senior Member

Joined: Sun Oct 30, 2005 7:52 pm
Posts: 97
nacho wrote:
The DNS record is set up for the domain without www. prefix.

Unless this is a typo, a redirect to 'www.example.com' by the webserver for 'example.com' is not going to work unless you have a resource record (RR) pointing to a destination for www, such as a CNAME, A, or AAAA record.

What happens when you try http:///example.com from a webroswer? This information (domain not found, 404, etc) might help someone clue in on the problem at hand. Actually providing the domain(s) would allow someone to maybe diagnosing the problem, without requiring feedback from you.

My suggestions: 1) Rule out DNS: verify DNS records exist and are correct, 2) Verify the rewrite configuration is correct (not my area of expertise), 3) check your web server logs as to what is happening to the requests.

I suspect if it's a web server configuration problem, it's most likely a typo. Try copying the configuration from one of the working domains, then paste it modifying it for the not working domain.

--
Travis


Top
   
 Post subject: The answer
PostPosted: Tue Oct 12, 2010 2:02 pm 
Offline
Newbie

Joined: Fri Oct 08, 2010 12:43 pm
Posts: 2
Website: http://www.chiringapress.com
Location: Texas
I think the problem was that when I set up this linode, I associated the domain name with the ip address in /etc/host

127.0.0.1 localhost
173.255.192.16 example.com example

This, it think, was allowing the domain to be resolved without reference to the vhost configuration.


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