Office-Shadow
asked on
Virtual hosts not workiing on Apache
Hi,
We have one production server which hosts a dozen or so domains, some of which have many subdomains.
This server is running PHP4 and I want to upgrade it to PHP5. To make sure there are no problems doing so, I want to copy the existing sites onto a development server set up with PHP5 and start debugging that.
I've got the server set up with Debian (same as the live server) and have installed the latest stable versions of PHP/MYSQL on it.
After consulting a more server-savvy friend it was suggested that I:
* Copy across the contents of /etc/apache2/sites-availab le
* Copy across the website place to the same location on thh new server
* Point the relevent domains to the new server's IP in my hosts file
So I attemted this for a single domain and the first problem encountered was that, other than a file called 'default', there was nothing in my sites-available folder on the live server.
These domains were originally set up using Plesk which seems to have a different way of managing vhosts. Looking in /var/www/vhosts/example.co m/conf there is a file called httpd.include which seemed to contain the required information (attached), so I tried copying this to sites-available and disabling 'default'.
I've restarted apache, and tried to access the URL in my browser and it just takes lists the contents of /var/www instead of showing the
As you can tell, I'm no server expert - I'm a programmer - so I'm not entirely sure what I'm doing!
Any help would be much appreciated!
We have one production server which hosts a dozen or so domains, some of which have many subdomains.
This server is running PHP4 and I want to upgrade it to PHP5. To make sure there are no problems doing so, I want to copy the existing sites onto a development server set up with PHP5 and start debugging that.
I've got the server set up with Debian (same as the live server) and have installed the latest stable versions of PHP/MYSQL on it.
After consulting a more server-savvy friend it was suggested that I:
* Copy across the contents of /etc/apache2/sites-availab
* Copy across the website place to the same location on thh new server
* Point the relevent domains to the new server's IP in my hosts file
So I attemted this for a single domain and the first problem encountered was that, other than a file called 'default', there was nothing in my sites-available folder on the live server.
These domains were originally set up using Plesk which seems to have a different way of managing vhosts. Looking in /var/www/vhosts/example.co
I've restarted apache, and tried to access the URL in my browser and it just takes lists the contents of /var/www instead of showing the
As you can tell, I'm no server expert - I'm a programmer - so I'm not entirely sure what I'm doing!
Any help would be much appreciated!
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
UseCanonicalName Off
ServerAdmin "exampel@example.com"
DocumentRoot /var/www/vhosts/example.com/httpdocs
CustomLog /var/www/vhosts/example.com/statistics/logs/access_log plesklog
ErrorLog /var/www/vhosts/example.com/statistics/logs/error_log
<IfModule mod_userdir.c>
UserDir /var/www/vhosts/example.com/web_users
</IfModule>
ScriptAlias /cgi-bin/ /var/www/vhosts/example.com/cgi-bin/
Alias /plesk-stat /var/www/vhosts/example.com/statistics/
<Location /plesk-stat/>
Options +Indexes
</Location>
<Location /plesk-stat/logs/>
Require valid-user
</Location>
Alias /webstat /var/www/vhosts/example.com/statistics/webstat
Alias /webstat-ssl /var/www/vhosts/example.com/statistics/webstat-ssl
Alias /ftpstat /var/www/vhosts/example.com/statistics/ftpstat
Alias /anon_ftpstat /var/www/vhosts/example.com/statistics/anon_ftpstat
Alias /awstats-icon /usr/share/awstats/icon
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /var/www/vhosts/example.com/httpdocs>
<IfModule mod_perl.c>
<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<IfModule mod_php4.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_python.c>
<Files ~ (\.py$)>
SetHandler python-program
PythonHandler mod_python.cgihandler
</Files>
</IfModule>
Options -Includes +ExecCGI
</Directory>
<Directory /var/www/vhosts/example.com/web_users>
<IfModule mod_php4.c>
php_admin_flag engine off
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine off
</IfModule>
</Directory>
</VirtualHost>
ASKER
Thanks fosiul, but I'm really not sure what I'd need to change from your vhosts file.
As an update, I have tried starting again and followed this guide exactly: http://www.debuntu.org/2006/02/22/7-virtual-hosting-using-apache-2
I still had the same result of listing the /var/www/ contents.
Any more suggestions
As an update, I have tried starting again and followed this guide exactly: http://www.debuntu.org/2006/02/22/7-virtual-hosting-using-apache-2
I still had the same result of listing the /var/www/ contents.
Any more suggestions
HI yah, they way your tutorial described, i did different way.
i didnot had to create any file called dev.example.com
give little bit of time, i need to see little bit of more configuration in myserver. as i am out of office
i will do that tomorrow morning
i didnot had to create any file called dev.example.com
give little bit of time, i need to see little bit of more configuration in myserver. as i am out of office
i will do that tomorrow morning
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hiya, no I do not have that line because I do not have a file at /etc/httpd/conf/vhosts
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm running Debian linux.
I have a couple different httpd.conf's:
/etc/apache2/httpd.conf - this one is blank
/etc/apache/httpd.conf - the last line of this is 'Include /etc/apache/conf.d', which is an empty directory.
I have a couple different httpd.conf's:
/etc/apache2/httpd.conf - this one is blank
/etc/apache/httpd.conf - the last line of this is 'Include /etc/apache/conf.d', which is an empty directory.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes that was the problem, I've now disabled apache and started apache and have got my vhost working! thanks for your help fosiul01
the Vhosts file should be in /etc/httpd/conf
and file called vhosts
I am attaching my vhosts, try to follow , hopefully it will work.
you will have to type your document path like this : DocumentRoot /var/www/html/intranet
but in your vhosts file i am seeing like this : DocumentRoot /var/www/vhosts/example.co
I dont think, you have vhosts folder under your www folder
anyway, see my vhosts configuration, if it help you
Open in new window