1

I'm using wampserver as my HTTP host. And I configured ssl to allow HTTPS connection to my site. I followed this guidance: [http://forum.wampserver.com/read.php?2,32986]. I generated the CRT and key by myself with openssl, but I didn't send the CSR to a CA (I think it doesn't matter except that the browser will report an "unsafe" report).

The services started normally. I can access my website through http://localhost/ or http://162.105.250.110/. But when I try to visit the site via HTTPS (through URL https://localhost/ or https://162.105.250.110/, I got an 403 error with the page showing "You don't have permission to access / on this server.". How can I deal with this?


Here are my httpd config files. (Commented lines are removed to save the words.)

The httpd.conf file:

ServerSignature On
ServerTokens Full



Define APACHE24 Apache2.4
Define VERSION_APACHE 2.4.23
Define INSTALL_DIR c:/wamp64
Define APACHE_DIR ${INSTALL_DIR}/bin/apache/apache${VERSION_APACHE}

ServerRoot "${APACHE_DIR}"



Listen 0.0.0.0:80
Listen [::0]:80

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cache_module modules/mod_cache.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so

LoadModule php7_module "${INSTALL_DIR}/bin/php/php7.0.10/php7apache2_4.dll"

<IfModule unixd_module>
User daemon
Group daemon

</IfModule>


ServerAdmin wampserver@wampserver.invalid

ServerName localhost:80

<Directory />
    AllowOverride none
    Require all denied
</Directory>

HostnameLookups Off

DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
    Options +Indexes +FollowSymLinks +Multiviews

    AllowOverride all


    Require local
</Directory>

<IfModule dir_module>
    DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "${INSTALL_DIR}/logs/apache_error.log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "${INSTALL_DIR}/logs/access.log" common
</IfModule>

<IfModule alias_module>


    ScriptAlias /cgi-bin/ "${INSTALL_DIR}/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "${INSTALL_DIR}/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    TypesConfig conf/mime.types

    AddEncoding x-compress .Z
    AddEncoding x-gzip .gz .tgz
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3

</IfModule>

EnableSendfile off

AcceptFilter http none
AcceptFilter https none

Include conf/extra/httpd-autoindex.conf

Include conf/extra/httpd-vhosts.conf

<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Include conf/extra/httpd-ssl.conf

Include "${INSTALL_DIR}/alias/*"

The httpd-ssl.conf file:

Listen 443

SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4

SSLHonorCipherOrder on 

SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3

SSLPassPhraseDialog  builtin

<VirtualHost _default_:443>

DocumentRoot "c:/wamp64/www/"
ServerName 162.105.250.110:443
ServerAdmin admin@example.com
ErrorLog "c:/wamp64/bin/apache/apache2.4.23/logs/error.log"
TransferLog "c:/wamp64/bin/apache/apache2.4.23/logs/access.log"

SSLEngine on

SSLCertificateFile "c:/wamp64/bin/apache/apache2.4.23/conf/ssl.crt/server.crt"

SSLCertificateKeyFile "c:/wamp64/bin/apache/apache2.4.23/conf/ssl.key/server.key"

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Require all granted
</Directory>

BrowserMatch "MSIE [2-5]" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

CustomLog "c:/wamp64/bin/apache/apache2.4.23/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>                                  
Cosmo
  • 836
  • 1
  • 12
  • 27

2 Answers2

2

Also your browser complains about the certificate because it is not signed by a known CA, no big deal for your personal server, and since you get a 403 that means SSL has been negotiated correctly.

As for the 403 error. You are mixing 2.2 (Order) with 2.4 directives(Require) which will cause issues.

Try this:

<Directory "c:/wamp64/www/">
   Options Indexes FollowSymLinks MultiViews
   Require all granted
   AllowOverride none
</Directory>

Once you notice you get access to the documentroot, add whatever else you may need.

Notes:

  • I set AllowOverride to none because: 1º you have access to your own server, hence you don't need it. 2º it may override your configuration in virtualhost with configuration from .htaccess files you haven't pasted.

  • You should unload mod_access_compat and use 2.4 directives only to avoid mixing with 2.2 directives by mistake.

Daniel Ferradal
  • 2,727
  • 1
  • 13
  • 19
  • This fixed my problems. And you let me know what does `Require` and `Order` do. (I have been confused for a long time :P ). Thanks so much! – Cosmo Nov 16 '16 at 01:56
  • just keep in mind Order/Allow-Deny are 2.2 directives and 2.4 is the one directive to get rid of that confusion. Better check the documentation about the upgrade, it will explain you better than I [Upgrading](https://httpd.apache.org/docs/2.4/upgrading.html#run-time) – Daniel Ferradal Nov 19 '16 at 09:42
  • I have the same problem now 2020, but cant fix it by this directives. Is there any other issue? – Čamo Jul 08 '20 at 18:41
  • So my problem was on line DocumentRoot "${SRVROOT}/www" in httpd-ssl.conf. It has to be c:/wamp64-3-2-0/www in my case. – Čamo Jul 08 '20 at 19:03
1

Same problem happens to me even without HTTPS I spent hours fighting with it and it works only after changing

httpd-vhosts.conf located at wamp64\bin\apache\apache2.4.23\conf\extra

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot d:/wamp64/www
    <Directory  "d:/wamp64/www/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Order Deny,Allow
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

Also you can read this https://stackoverflow.com/a/26252312/3938407 I followed it carefully and it works

Community
  • 1
  • 1
TEST USER
  • 41
  • 1
  • 6
  • 1
    Order and Allow/Deny are 2.2 directives. If you mix them with Require, which is a 2.4 directive, then you are bound for trouble. – Daniel Ferradal Nov 19 '16 at 09:40