LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Apache -VirtualHost (http://www.linuxquestions.org/questions/debian-26/apache-virtualhost-354787/)

davidhk 08-19-2005 02:58 AM

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/

sims 08-19-2005 06:12 AM

1) The Apache config files should be in /etc/apache
2) Default document root is /var/www

davidhk 08-19-2005 07:24 AM

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

tomj88 08-19-2005 08:55 AM

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)

davidhk 08-19-2005 10:01 AM

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,

tomj88 08-19-2005 10:17 AM

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/>

saman007uk 08-19-2005 01:20 PM

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.

davidhk 08-19-2005 01:33 PM

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


:cool:


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