[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

keep getting 403 access forbidden using apache webserver

Hello,

I am an Apache newbie but I will try and describe the issue the best I can.

I have XAMPP 1.8.3 / XAMPP control panel 3.2.1 with Apache 2.4.7 running on a server using Windows server 2012 and I want to use this server to host multiple websites with different domains.

I initially setup my first website on there and everything worked ok however when I went to add a different site with different domain things started to go wrong. Now when I visit http://www.myfirstsite.co.uk I get this error:

Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403

www.MYFIRSTSITE.co.uk
Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9


However if I go to https://www.myfirstsite.co.uk it works fine and the SSL works fine.

If i try to try to browse to http://www.mysecondsite.co.uk I getr the same 403 error and if I go to https://www.mysecondsite.co.uk it takes me to my first website.

Here is a copy of my httpd-vhosts.conf file

# Virtual Hosts
#
# Required modules: mod_log_config

# 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.4/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 "C:/xampp/htdocs/dummy-host.example.com"
    ##ServerName dummy-host.example.com
    ##ServerAlias www.dummy-host.example.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "E:\www\myfirstsite.co.uk\dev\htdocs"
    ServerName www.myfirstsite.co.uk
      ServerAlias myfirstsite.co.uk
    <Directory "E:\www\myfirstsite.co.uk\dev\htdocs">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot "E:\www\myfirstsite.co.uk\dev\htdocs"
    ServerName www.myfirstsite.co.uk
    SSLEngine on
    SSLCertificateFile "C:/xampp/apache/conf/ssl.crt/www_myfirstsite.co.uk.crt"
    SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/www_myfirstsite.co.uk.key"
    SSLCertificateChainFile "C:/xampp/apache/conf/ssl.chain/DigiCertCA.crt"

    <Directory "E:\www\myfirstsite.co.uk\dev\htdocs">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost 172.16.0.20:80>
      ServerAdmin support@mysecondsite.co.uk
      DocumentRoot "E:\www\mysecondsite.co.uk\htdocs"
      ServerName www.mysecondsite.co.uk
      ServerAlias mysecondsite.co.uk
      ServerAlias www.mysecondsite.com
      ServerAlias mysecondsite.com
      DirectoryIndex index.html
      <Directory "E:\www\mysecondsite.co.uk\htdocs">
            Options Indexes FollowSymLinks Includes ExecCGI
            AllowOverride All
            Order allow,deny
            Allow from all
      </Directory>
</VirtualHost>



Any help with this would be very much appreciated.

Thanks
0
purpleoak
Asked:
purpleoak
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
You have two <VirtualHost *:80> on port 80.  Comment out the second one and see if the first one works then.
0
 
purpleoakAuthor Commented:
This has not made a difference...this is still and issue, please advise.
0
 
bansidharCommented:
Check if the file E:\www\mysecondsite.co.uk\htdocs\index.html exists. Second You have not defined any virtual host the handle https://www.mysecondsite.co.uk so it goes to the default (first) site.

Note: Use forward slash instead of backslash even in windows. Apache likes unix style filename syntax.

DocumentRoot "E:/www/mysecondsite.co.uk/htdocs"
<Directory "E:/www/mysecondsite.co.uk/htdocs">

etc...

Edit: sry, didn't notice this was a very old question.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now