Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Apr 19, 2012 3:23 am 
Offline
Senior Member

Joined: Thu Apr 12, 2012 6:26 am
Posts: 62
Location: Earth
Hi all,

I have just installed and configured Apache on our new Linode which runs CentOS 6.
I also configured virtual hosts and it is working fine.
I have also installed and configured MySQL and PHP.
However, I have uploaded some applications like mysql to the default apache document root:
/var/www/html

but navigating via our server's IP this way: http://123.123.123.123/phpmyadmin

brings up:
"Not Found

The requested URL /phpmyadmin was not found on this server."

almost as if it is not calling up the default apache document root.

Could I have been doing something wrong?

To my undersanding, virtual hosts should not affect the default document root. Is this thinking right?

Thanks in advance for your help.


Top
   
 Post subject:
PostPosted: Thu Apr 19, 2012 6:45 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Do you have a VirtualHost block with 123.123.123.123 as either ServerName or ServerAlias? If not, then Apache will route requests for 123.123.123.123 to the first VirtualHost block it finds, which might not be the one you think.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Thu Apr 19, 2012 7:32 pm 
Offline
Senior Member

Joined: Thu Apr 12, 2012 6:26 am
Posts: 62
Location: Earth
Thanks @hoopycat.

Here's what the VirtualHost section of my Apache configuration file looks like:
<VirtualHost *:80>
ServerAdmin webmaster@mysite1.com
DocumentRoot /var/www/vhosts/mysite1.com/httpdocs/
ServerName mysite1.com
ServerAlias www.mysite1.com
<Directory /var/www/vhosts/mysite1.com/httpdocs/>
AllowOverride all
</Directory>
ErrorLog logs/mysite1.com-error_log
CustomLog logs/mysite1.com-access_log common
</VirtualHost>


<VirtualHost *:80>
ServerAdmin webmaster@mysite2.com
DocumentRoot /var/www/vhosts/mysite2.com/httpdocs/
ServerName mysite2.com
ServerAlias www.mysite2.com
<Directory /var/www/vhosts/mysite2.com/httpdocs/>
AllowOverride all
</Directory>
</VirtualHost>

Thanks.


Top
   
 Post subject:
PostPosted: Sun Apr 22, 2012 11:04 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
It sounds like it is most likely treating "unknown" destinations as being part of mysite1.com, the first VirtualHost listed. A fix for this is to create a 'default' vhost, with perhaps ServerName localhost or some other generic thing, and put what you want for unknown destinations in there. Make sure it loads first: if you're using the sites-enabled directory structure, make the file come first in alphabetical order when you do an 'ls'.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Mon Apr 23, 2012 4:54 am 
Offline
Senior Member

Joined: Thu Apr 12, 2012 6:26 am
Posts: 62
Location: Earth
Thanks @hoopycat.
It seems to be working fine now...

Here's what the virtual host section of my httpd.conf file now looks like:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
ServerName localhost
ServerAlias http://localhost/
<Directory /var/www/html/>
AllowOverride all
</Directory>
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@mysite1.com
DocumentRoot /var/www/vhosts/mysite1.com/httpdocs/
ServerName mysite1.com
ServerAlias www.mysite1.com
<Directory /var/www/vhosts/mysite1.com/httpdocs/>
AllowOverride all
</Directory>
ErrorLog logs/mysite1.com-error_log
CustomLog logs/mysite1.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@mysite2.com
DocumentRoot /var/www/vhosts/mysite2.com/httpdocs/
ServerName mysite2.com
ServerAlias www.mysite2.com
<Directory /var/www/vhosts/mysite2.com/httpdocs/>
AllowOverride all
</Directory>
</VirtualHost>


However, what did you mean by "if you're using the sites-enabled directory structure, make the file come first in alphabetical order when you do an 'ls'."?

How does that work (i.e a site enabled directory structure)?

Thanks a lot for your help.

Regards,


Top
   
 Post subject:
PostPosted: Mon Apr 23, 2012 6:19 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
I don't believe CentOS uses it, so it doesn't apply in this case. Basically, each virtual host would get its own file in a directory called /etc/apache2/sites-available/, and then symlinks are created from /etc/apache2/sites-enabled/ to each of those files. But don't sweat it. :-)

_________________
Code:
/* TODO: need to add signature to posts */


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


Who is online

Users browsing this forum: No registered users and 3 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