Page 1 of 1

httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 09:14
by nkamp
Hello,

I'm new to XAMPP - webservers. I have installed XAMPP on my d drive like d:\XAMPP and then the different dirs.
On my E drive I have all kind of development things and I read about vhosts so I thought, I bring all my htdocs to e:\htdocs. I have moved the directorys from d:\XAMPP\htdocs\ to:
e:\htdocs\dijkman-wsv
e:\htdocs\cms_ms
etc.

I have only the httpd-vhosts.conf changed with this:
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot D:/xampp/htdocs
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot e:/htdocs/dijkman-wsv
    ServerName dijkman-wsv.dev
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot e:/htdocs/cms_ms
    ServerName cms_ms.dev
</VirtualHost>


I have add the following lines to the host file
Code: Select all
127.0.0.1       localhost
127.0.0.1        dijkman-wsv.dev
127.0.0.1        cms_ms.dev


When I fill the next URL in my browser: http://dijkman-wsv.dev or http://cms_ms.dev, Then I get the error HTTP 403 Access denied.
Message log file:
Code: Select all
[Mon Jun 08 22:57:18 2009] [error] [client 127.0.0.1] client denied by server configuration: E:/htdocs/dijkman-wsv/


If I switch off the firewall doesn't help.
(Ok, I have also installed the IIS on this machine but I have switched off the IIS, www, SMTP service etc. as well)
The localhost phpmyadmin, XAMPP (welcome page) etc. are still good working!

It seems to me that I have exactly done what is written on http://www.ardamis.com/2005/08/11/xampp ... rtualhost/.

Is there anybody who can explain what I must do? Has it something to do with port 80?
I have also read something about httpd.conf, that you have to configure that the user must have the rights to access e:\htdocs. But honestly I think I know -but I'm not sure, I have to look- under which user XAMPP is running but how to change his user-group rights.....

Thanks in advance,

Nico

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 11:16
by Wiedmann
For each of your two vhosts, you need a directory block for the DocumentRoot, which allows access (and maybe set some other options).

(Hint: See the Directory block for your main DocumentRoot in httpd.conf)

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 13:46
by nkamp
I do not good understand what you mean, and that's I think more my problem then yours, but what do you mean with "... you need a directory block for the DocumentRoot...".

Although I don't know what it exactly means, do you mean this:
Code: Select all
<VirtualHost *:80>
    DocumentRoot e:/htdocs/dijkman-wsv
    ServerName dijkman-wsv.dev
   Options FollowSymLinks
   AllowOverride None
   Order deny,allow
   Deny from all
</VirtualHost>


If this works, why does it work without these lines by Ardamis? Because I do it on a different drive?

Nico

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 15:42
by Wiedmann
why does it work without these lines by Ardamis?

What/who is "Ardamis"?

Because I do it on a different drive?

Yes.

do you mean this:

A Directory block starts with "<Directory ...>" and ends with "</Directory>".
(replace "..." with a path, e.g. the DocumentRoot for this vhost)

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 17:08
by nkamp
Sorry, Ardamis is the site where I read my first things about vhosts: http://www.ardamis.com/2005/08/11/xampp ... rtualhost/. There he writes how he did it.

tonight I will try it the next thing:
I have found this in my httpd.conf
Code: Select all
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
#
#
<Directory "/xampp/htdocs">
#ND van de Kamp aangepast
#<Directory "e:/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI
   
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # NKamp aangepast in overleg met Jan Huibers. De onderstaand regel was uitgecommentarieerd
   #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>


And I have tried different things in my httpd-vhosts.conf
Code: Select all
<VirtualHost *:80>
    DocumentRoot "e:/htdocs/dijkman-wsv"
    ServerName dijkman-wsv.dev
    Options FollowSymLinks
    #AllowOverride None       If I enable these lines then Apache doesn't even start!
    #Order deny,allow
    #Deny from all
   CustomLog logs/dijkman-wsv.dev.access.log combined
    ErrorLog logs/dijkman-wsv.dev.error.log
</VirtualHost>


I DO NOT UNDERSTAND WHY MY VIRTUAL HOST DOESN'T WORK.

Apache user and his rights

PostPosted: 09. June 2009 20:37
by nkamp
Hello,

So as I already earlier mentioned I'm new to Apache webserver. But I like to work with vhosts. I have moved the site's from d:/XAMPP/htdocs to e:/htdocs/website. But now I get the error HTTP 403 access denied. In my other topic I have written what I hava tried to do.

Maybe a stupied question but I have installed Apache on my development laptop and it works fine. But I'm not sure but I think I have filled in a username for Apache. But where can I find the user and his rights? Because can that have something todo with the user rights?

Or what else can it be "HTTP 403 Access denied........"

Nico

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 20:52
by Wiedmann
Code: Select all
<Directory "/xampp/htdocs">
#ND van de Kamp aangepast
#<Directory "e:/htdocs">

Don't change this Directory block in httpd,conf. But add similar Directory blocks to each of your 2 vhosts.

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 21:46
by nkamp
I have fount the solution. I have the next line changed in httpd.conf file:
Code: Select all
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    #Deny from all  #This is the original line
    Allow from all    #Changed to this line
    Satisfy all
</Directory>


'Normal' site's (HTML) are working but I have problems with the php site's. Does that have anything to do with php.ini. Must I change the include path or ..........
Code: Select all
Warning: session_start() [function.session-start]: open(\xampp\tmp\sess_e3a9c80099fad3b0be6d24c38f19087f, O_RDWR) failed: No such file or directory (2) in E:\htdocs\sedapcatering\include.php on line 34

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at E:\htdocs\sedapcatering\include.php:34) in E:\htdocs\sedapcatering\include.php on line 34

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\htdocs\sedapcatering\include.php:34) in E:\htdocs\sedapcatering\include.php on line 34
string(113) "Smarty error: [in tpl_top:20 line 1]: [plugin] unknown tag - 'process_pagedata' (core.load_plugins.php, line 124)"
Fatal error: Call to undefined function smarty_cms_function_process_pagedata() in E:\htdocs\sedapcatering\tmp\templates_c\%%BC^BCE^BCE9A9A7%%tpl_top%3A20.php on line 5

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 09. June 2009 21:52
by Wiedmann
I have fount the solution.

No.

I have the next line changed in httpd.conf file:

Don't change this special Directory block (because of security reasons).

httpd-vhosts.conf --> HTTP Error 401

PostPosted: 11. June 2009 20:14
by nkamp
Hello,

Yesterday I had the error HTTP 403. Now I have the error HTPP 401!
Without vhosts, that means if I use the normal htdocs dir, everything is working fine.
I'm working with:
- windows xp
- XAMPP
- vhosts - php.
- I have changed in my php session save path ==> so I don't have errors about session, but after I have changed this, I do now get the HTTP error 401.

Thanks in advanced,

Nico

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 11. June 2009 21:26
by DurkO
I use this code for vhost and it's giving no problem at all:
Code: Select all
<VirtualHost *:80>
    DocumentRoot "K:/xampp/xampp/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "I:/www/cms/"
    ServerName cms.tld
   ServerAlias cms.tld *.cms.tld
  <Directory "I:/www/cms/">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "I:/www/test/"
    ServerName test.tld
   ServerAlias test.tld *.test.tld
  <Directory "I:/www/test/">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

Good luck!

Re: httpd-vhosts.conf --> HTTP Error 403

PostPosted: 13. June 2009 22:05
by nkamp
Thank you very much. I didn't know of the directory in the vhosts. So I have learned something and almost everything is working fine except one site. That's a own build php site (I mean otherones are flash, joomla, cmsmadesimple) and i get the error HTTP 401 Access Denied.

I don't know why but I hope I will find it soon.

Thanks anyway.

Nico