LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-20-2011, 09:15 AM   #1
cipher7836
Member
 
Registered: Dec 2008
Posts: 35

Rep: Reputation: 15
Is It VHosts???


Hello all, about two years ago I setup a LAMP server for a web design company. They wanted Plesk installed on a RH64 bit system. I setup Plesk, everything worked, and that was it. Fast forward two years later and Rackspace is no longer supporting RH64 bit. So the customer wants the same exact setup MINUS PLESK on a new server running CentOS5.

I setup LAMP and it worked. The problem is that on the old server he had a vhosts directory. I supposed Plesk changed httpd.conf to add a vhost so that this site could be seen. I tranfered all the var/www/html files from the old serverm including vhosts, but when I type the IP only the default Apache page comes up. I even used the old httpd.conf from the old server, but STILL the Apache page comes up.

What am I doing wrong? Can anyone help me?
 
Old 12-20-2011, 01:48 PM   #2
netnix99
Member
 
Registered: Jun 2011
Distribution: redhat, CentOS, OpenBSD
Posts: 298

Rep: Reputation: 99
Cipher7836,

I am running Apache 2.2.16...and the vhost information is located at /usr/local/apache/conf/extra/httpd-vhosts.conf. It sounds like you need to make sure that file is accessible from the /usr/local/apache/conf/httpd.conf. There is a line in the /usr/local/apache/conf/httpd.conf that looks like this:

# Virtual Hosts
#Include conf/extra/httpd-vhosts.conf

The include line would be un-commented in order for it to access the httpd-vhosts.conf in the extra directory. Your file structure may not be exactly like this, but this should be enough information that you could search through and find what you are looking for.

Good Luck.....
 
Old 12-20-2011, 03:02 PM   #3
cipher7836
Member
 
Registered: Dec 2008
Posts: 35

Original Poster
Rep: Reputation: 15
Thanks!

Thank you so much. I'm going to try it now.
 
Old 12-21-2011, 10:17 AM   #4
cipher7836
Member
 
Registered: Dec 2008
Posts: 35

Original Poster
Rep: Reputation: 15
Frustration

I can't seem to find the file you're talking about in CentOS 5. I read that you have to configure vhosts in httpd.conf, which I did, and when I open the page I get "forbidden" even if I change the permissions to 777. What the heck am I doing wrong? Should I post the httpd.conf for you all to see? Or should I just quit, suck my thumb, and lie down in the fetal position?
 
Old 12-21-2011, 06:38 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Well, these pages should help https://httpd.apache.org/docs/2.2/vhosts/ which is linked from the RHEL5 admin manual http://www.linuxtopia.org/online_boo...tualhosts.html (same for Centos).

Also, I think taking a look at the Apache error_log when that happens or even /var/log/messages may help get more detail.

This https://httpd.apache.org/docs/2.2/vhosts/examples.html implies that doing vhosts inside httpd.conf is fine.
 
Old 12-23-2011, 03:12 PM   #6
cipher7836
Member
 
Registered: Dec 2008
Posts: 35

Original Poster
Rep: Reputation: 15
So far everything works well, but I get the following error when clicking on http://www.foo.com/cron/calc_bw/



A PHP Error was encountered
Severity: Warning

Message: fopen(/var/log/httpd/access_log) [function.fopen]: failed to open stream: Permission denied

Filename: cb/cron.php

Line Number: 52

Line 52 is looking for a log file that it has access to, and the permissions were set to 777 just to see if that would fix it. But no go. Any ideas??????
 
Old 12-23-2011, 03:54 PM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Line 52 is looking for a log file that it has access to, and the permissions were set to 777 just to see if that would fix it. But no go. Any ideas??????
SELinux?
 
Old 12-24-2011, 11:21 AM   #8
cipher7836
Member
 
Registered: Dec 2008
Posts: 35

Original Poster
Rep: Reputation: 15
Selinux

Any other ideas???
 
Old 01-03-2012, 09:40 AM   #9
netnix99
Member
 
Registered: Jun 2011
Distribution: redhat, CentOS, OpenBSD
Posts: 298

Rep: Reputation: 99
cipher7836,

here is an idea.... create the folder /etc/httpd/conf/extra with 755 permissions. Assuming you are using the RH package for your Apache server, /etc/httpd/conf should already exist. Create a file in your /etc/httpd/conf/extra folder with the text from the httpd-vhonsts.conf file below. This is an unedited copy of the virtual hosts configuration file. You will need to edit it according to your setup. Next, Edit this line in /etc/httpd/conf/httpd.conf:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

to look like this:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

After all permissions/ownership are set accordingly, and the configuration files are edited to represent your setup, restart the httpd service and you should be good.


httpd-vhosts.conf

# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/var/www/html/server1"
ServerName servername1
ServerAlias servername1
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common

<Directory "/var/www/html/*" >
# Options FollowSymLinks
# AllowOverride None
# Order allow,deny
Allow from all
</Directory>

</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/var/www/html/server2"
ServerName servername2
ServerAlias servername2
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

Last edited by netnix99; 01-03-2012 at 10:20 AM. Reason: add attachment
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vhosts M_C Linux - Server 1 09-03-2007 11:09 AM
how to restrict vhosts ruleman Linux - Security 0 02-09-2004 03:01 AM
vhosts !? skate Linux - Software 1 08-13-2003 04:23 PM
vhosts h8r Linux - Networking 3 01-18-2003 09:24 AM
vhosts h8r Linux - General 3 01-18-2003 09:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration