Getting 403 forbidden error on WAMP server when usng SSL - ssl

I have just spent the last 4 hours trying to get SSL working on my local devolopment wamp server (windows 7).
Everything seems to be setup ok now, well the server restarts without any errors at least!!
The only issue I can not seem to solve is a 403 forbidden when I try to access my site through HTTPS (SSL 443). It works fine on port 80, just not on 443.
The error log shows the following
[error] [client 127.0.0.1] client denied by server configuration: F:/My Webs/freedate/public_html/
My http.conf file has the following vhost added
<VirtualHost *:80>
ServerName www.freedate.local
ServerAlias freedate.local *.freedate.local
DocumentRoot "F:\My Webs\freedate\public_html"
<Directory "F:\My Webs\freedate\public_html">
allow from all
order allow,deny
# Enables .htaccess files for this site
AllowOverride All
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
And my httpd-ssl.conf has the following vhost added
<VirtualHost *:443>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "C:/wamp/bin/apache/Apache2.2.21/conf/ssl/server.crt"
SSLCertificateKeyFile "C:/wamp/bin/apache/Apache2.2.21/conf/ssl/server.key"
ServerName www.freedate.local
ServerAlias freedate.local *.freedate.local
DocumentRoot "F:\My Webs\freedate\public_html"
<Directory "F:\My Webs\freedate\public_html">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
If anyone can spot what I am doing wrong I would be most grateful, many thanks.
Kind regards
Garry

Although this is a very old question, I faced the same issue today and I am giving the solution here for anyone facing this issue in the future.
This solution should work if everything is working without SSL. You can find help working without SSL here: https://stackoverflow.com/a/14671738/2407971
In the httpd-ssl.conf file, between the <VirtualHost _default_:443> and </VirtualHost> code blocks, you will find something like this:
<Directory "c:/Apache24/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
After these lines, insert the following code:
<Directory "c:/wamp64/www/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory "c:/wamp64/www/yoursite/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
This will basically allow the root directory of the www folder and yoursite to be accessible in SSL.
Restart the server and test your site.
Hope it helps.

Related

My apache2 VirtualHost keep showing "It's working" instead of my site

I'm doing a project for school where I have to host 2 pages on a web server. I chose to do a VirtualHost using Apache2 but when it keeps showing me a "It works" page. The page is located here.
We are using a DNS server but the probleme seems to not be coming from this one.
Here is one of the .conf file :
<VirtualHost *:80>
ServerAdmin jongen.philemon#wt5.ephec-ti.be
ServerName wt5.ephec-ti.be
ServerAlias www.wt5.ephec-ti.be
DocumentRoot /var/www/monsite
<Directory /><br>
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/monsite>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
I also changed the apache2.conf like this:
<VirtualHost *:80>
ServerAdmin jongen.philemon#wt5.ephec-ti.be
DocumentRoot /var/www/site
<Directory /var/www/site/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
You can also check our wiki on the GitHub to see all the steps I followed.
Thank's
I got to fix it by re-doing it using a Dockerfile. I uptated the files and the wiki on my github if you have the same issue !

500 Internal Server Error when trying to enable use of .htaccess in Apache on Ubuntu

I am trying to get my .htaccess working on my Ubuntu-apache2-webserver.
For that I opened /etc/apache2/apache2.conf,
I removed the comment sign (#) before AccessFileName .htaccess
and replaced AllowOverride None by AllowOverride All in
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I activated mod_rewrite via a2enmod rewrite and restarted the server.
But each time I am performing those changes and open an html-file placed inside of /var/www/html, I get a 500 Internal Server Error for Virtual Host 80.
The same thing happened to me when placing
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
before </VirtualHost> into the 000-default.conf-file instead of the /etc/apache2/apache2.conf.
Can anyone tell me what I am missing?
You're slightly off in your syntax for allowOverride. The Directory tag needs to be inside the VirtualHost tag. Like so:
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog /var/log/apache2/error.log
Options Includes
<Directory "/var/www/html">
AllowOverride All
</Directory>
</VirtualHost>
Also, make sure Apache has permissions to read and write to the directory /var/www/html

mywebsite.com shows index of / after installing Magento

I am running Virtual server by:
VirtualBox v5.2.12
Ubuntu v18.04
Apache v2.4.29
php 7.1.17
Magento v2.2.4
Everything goes fine till I install magento! Magento works find without any problem in the server but the problem here is when I entered mywebsite.com it shows my files and indexing and I want to show my index.html instead:
Index of /
Name Last modified Size Description
index.html 2018-05-28 03:47 180
info.php 2018-06-04 12:39 20
magento2/ 2018-05-01 23:21 -
Apache/2.4.29 (Ubuntu) Server at mywebsite.com Port 65533
I tried a lot of answer but without any success.
Here is /etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
And Here is /etc/apache2/sites-available/mywebsite.com.conf
Listen 65533
<VirtualHost mywebsite.com:65533>
ServerName www.mywebsite.com
ServerName mywebsite.com
ServerAdmin info#mywebsite.info
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot /var/www/mywebsite.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mywebsite.com/html/>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Here is /etc/apache2/sites-available/000-default.conf.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Finally I solved the issue .. been trying for a week!
The solution is:
Step 1- Inside this file "/etc/apache2/sites-available/mywebsite.com.conf" this should be the first directory strait after the virtualhsost info:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
And it will effect the whole file.. ok so far so good.
Step 2- I added a new directory specially for magento which is
<Directory /var/www/mywebsite.com/html/magento2>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
Step 3- sudo /etc/init.d/apache2 restart in order to restart the apache with status or just use any method to restart.
** The point here is you need to avoid directory Inheritance / one setting for all in order to work with each directory separately.
Hope someone get benefit from this post.
Thank you Andra for the little help.
Regards,
QLF

configure apache to allow directory listing

Hi installed wordpress as localhost on my machine. I wanted to access it from another machine on my LAN. I can access the page. But non of the images or css is applying, Looking in firebug it's riddled with 404 errors to all the files it required. the path specifies the IP and not Localhost and exist in their locations.
I am trying to set apache to allow file browsing via the website I have set HTTPD.CONF and .htaccess but cant get file browsing the site is located at c:\xampp\apache\htdocs
heres what I have in httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
AllowOverride all
Require all granted
</Directory>
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory "/wordpress">
AllowOverride all
Require all granted
Options Indexes FollowSymLinks
</Directory>
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/wordpress/index.php"
ServerName wordpress
</VirtualHost>
in .htaccess
Options +Indexes
the error.log doesn't contain anything that stands out to me
You have to specify the option +Indexes in the corresponding Directory:
<Directory "C:/xampp/apache/htdocs">
Options +Indexes
</Directory>

Apache ERR_CONNECTION_REFUSED over SSL on Ubuntu

I'm trying to set up an Apache (2.4) server on Ubuntu. For now I'm just trying to get it to serve static pages from /var/www/html (although eventually I want to run a WSGI Python app).
Here's my sites-available/website.conf file:
<VirtualHost *:443>
ServerAdmin email#gmail.com
ServerName website.com:443
SSLEngine on
SSLCertificateFile /root/website.csr
SSLCertificateKeyFile /root/website.key
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
(Replaced my actual domain with "website".)
When I try to connect to this by either going to my domain name or the server's IP, Chrome gives me ERR_CONNECTION_REFUSED ("This site can’t be reached").
I also tried with telnet:
root#website:/etc/apache2# telnet localhost 443
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
When I comment out all the lines to do with SSL from my config file, I can connect over telnet, but Chrome gives me ERR_SSL_PROTOCOL_ERROR ("This site can’t provide a secure connection", which I guess makes sense).
Here's also my ports.config, if that helps:
Listen 80
<IfModule ssl_module>
Listen 443
NameVirtualHost *:443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
(Yes, the SSL module is enabled.)
And the part of my apache2.conf that I often see referenced in similar questions:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
This is my first time setting up an Apache server, so I'm guessing I'm messing up something simple here?
Check if ssl mode is activated here:
sudo a2enmod ssl
sudo service apache2 restart
My problem was here:
SSLEngine on
SSLCertificateFile /root/website.csr
SSLCertificateKeyFile /root/website.key
I was linking to the .csr, not the .crt. I also didn't link to something intermediate.
Here's how it is now, which fixed it:
SSLEngine on
SSLCertificateFile /root/domain.crt
SSLCertificateKeyFile /root/domain.key
SSLCertificateChainFile /root/DigiCertCA.crt