LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 08-19-2005, 02:58 AM   #1
davidhk
Member
 
Registered: Jun 2005
Posts: 38

Rep: Reputation: 15
Apache -VirtualHost


newbie from fc3 to debian

1) In fedora, the conf file was in /etc/httpd/conf/httpd.conf. I only need to edit <VirutalHost>...,
Where is <VirtualHost> for debian? How to enable it ?

2) If I don't use Virtual Host, where should I put my index.html into, there is no /var/www/html/
 
Old 08-19-2005, 06:12 AM   #2
sims
Member
 
Registered: Mar 2004
Location: Australia
Distribution: Debian, Ubuntu
Posts: 55

Rep: Reputation: 15
1) The Apache config files should be in /etc/apache
2) Default document root is /var/www
 
Old 08-19-2005, 07:24 AM   #3
davidhk
Member
 
Registered: Jun 2005
Posts: 38

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by sims
1) The Apache config files should be in /etc/apache
2) Default document root is /var/www
newbie from fc3 to debian

1. How to check my apache version in Debian?
2. I found /etc/apache2 instead of /etc/apache , I believe it is bcos of diff version.
3. How to change the path for document root
4. Any document or link which I can find for virtual host-- I mean www.domaina.com can find the html at /var/ww/da, type www.domainb.com can find html at /var/www/db
 
Old 08-19-2005, 08:55 AM   #4
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Rep: Reputation: 30
try typing at a shell
Code:
ps -A | grep apache
If you use apache2 the configuration is very different from that of apache (1.x). Virtual hosts in apache2 (on debian) are at /etc/apache2/sites-available/ and you have to create a sym link to each file in /etc/apache2/sites-enabled/ (I suppose you could just drop the config file there if you wanted)
 
Old 08-19-2005, 10:01 AM   #5
davidhk
Member
 
Registered: Jun 2005
Posts: 38

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by tomj88
try typing at a shell
Code:
ps -A | grep apache
If you use apache2 the configuration is very different from that of apache (1.x). Virtual hosts in apache2 (on debian) are at /etc/apache2/sites-available/ and you have to create a sym link to each file in /etc/apache2/sites-enabled/ (I suppose you could just drop the config file there if you wanted)
Listed some info for you:-
dns:~# cd /etc/apache2/
dns:/etc/apache2# ls
README conf.d httpd.conf mods-available ports.conf
sites-enabled
apache2.conf envvars magic mods-enabled sites-available ssl

dns:/etc/apache2/sites-available# view default (please see below)
when I vi default, there is no "NameServer..." in it, I tried to add
"NameServer www.<mydomain>.com in it, change /var/www/ to /var/www/ps
(new directory for index.html), then restart apache2, but it doesn't
work. it seems could not find the file /var/www/ps/index.html

NameVirtualHost 202.x.x.x
<VirtualHost 202.x.x.x>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/ps/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

Thanks,
 
Old 08-19-2005, 10:17 AM   #6
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Rep: Reputation: 30
as root:

Code:
apache2 -k restart
also, you have to change this:
<Directory /var/www/> <<-- this line
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
RedirectMatch ^/$ /apache2-default/
</Directory>

so it says <Directory /var/www/ps/>
 
Old 08-19-2005, 01:20 PM   #7
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 363

Rep: Reputation: 32
It would be better to try an restart the service using the init script:
Code:
/etc/init.d/apache2 reload
In Debian, virtual-shost are in the folder /etc/apache2/sites-available and /etc/apache/sites-enabled, where each file in the sites-available contains one virtual-host and if you wish to enable a virtual-host, you need to create a symlink to the file in the sites-enabled folder.
 
Old 08-19-2005, 01:33 PM   #8
davidhk
Member
 
Registered: Jun 2005
Posts: 38

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by tomj88
as root:

Code:
apache2 -k restart
also, you have to change this:
<Directory /var/www/> <<-- this line
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
RedirectMatch ^/$ /apache2-default/
</Directory>

so it says <Directory /var/www/ps/>
-----
I believe I have done as you said, but still doesn't work,
1)
dns:/etc/apache2/sites-available# view default
NameVirtualHost 202.x.x.x
<VirtualHost 202.x.x.x>
ServerAdmin webmaster@localhost
ServerName www.<domain>.com
DocumentRoot /var/www/ps/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/ps/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log
2)
dns:/var/www/ps# pwd
/var/www/ps
dns:/var/www/ps# ls -la
total 12
drwxr-xr-x 2 root root 4096 Aug 19 18:26 .
drwxr-xr-x 4 root root 4096 Aug 19 18:25 ..
-rw-r--r-- 1 root root 204 Aug 19 18:26 index.html
3) If everything goes right... Hey,
what symbolic link you mentioned I need to make, please code


 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
apache + add a VirtualHost linuxtesting2 Linux - Newbie 2 09-03-2005 04:21 AM
VirtualHost Apache 2 Problem Chris_K1 Linux - Networking 0 01-25-2005 11:00 AM
Virtualhost setup on apache 2 notmatt Debian 2 10-28-2004 02:05 PM
Help with Apache <VirtualHost> please. smakkythecamel Linux - Networking 2 06-12-2003 08:15 PM
apache virtualhost jonfa Linux - Networking 5 08-12-2002 07:07 PM


All times are GMT -5. The time now is 07:37 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration