HTTP Forbidden 403
From:     https://serverfault.com/questions/1093201/apache2-why-do-i-get-a -403-forbidden-error




Apache2: Why do I get a 403 Forbidden error?
Asked 1 year, 5 months ago
Modified 1 year, 5 months ago
Viewed 3k times
0

I've been messing with this for days :(

Why do I get a 403 Forbidden error at example.com/contact?

Is this a file/folder permissions, Apache user, virtualhosts or Python
issue?

I'm trying to run a Django app at /contact but the first issue is the 403
error.

    I'm running Ubuntu 20.04.3 LTS
    Apache 2.4.41 installed and is running
    Python 3.8 and Django installed
    libapache2-mod-wsgi-py3 installed and enabled
    apachectl configtest Syntax OK
    All files chowned to www-data:www-data
    Directories chmod +x
    example.com/index.html works

/var/log/apache2/access.log is empty

/var/log/apache2/error.log contains:

    [mpm_prefork:notice] [pid 69090] AH00163: Apache/2.4.41 (Ubuntu)
OpenSSL/1.1.1k mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal
operations

    [core:notice] [pid 69090] AH00094: Command line: '/usr/sbin/apache2'

The .htaccess file at root has

 RewriteEngine on
 ServerSignature Off
 Options All -Indexes

This is my public_html file structure:

enter image description here

/etc/apache2/sites-available/default-ssl.conf:



	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	SSLEngine on
	SSLCertificateFile  /etc/ssl/certs/ssl-cert-snakeoil.pem
	SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

	
				SSLOptions +StdEnvVars
	
	
				SSLOptions +StdEnvVars
	

	Alias /static /var/www/html/example.com/public_html/contact/static
	Alias /media /var/www/html/example.com/public_html/contact/media


	Require all granted



	Require all granted


WSGIScriptAlias /contact/contact /var/www/html/examp
le.com/public_html/contact/contact/wsgi.py

WSGIDaemonProcess contact python-home=/var/www/html/
example.com/public_html/contact/contact

WSGIProcessGroup contact

WSGISocketPrefix run/wsgi


	
		Require all granted
		AllowOverride None
		Allow from all
	

	


    ubuntuapache-2.4virtualhostpython

BlueDogRanch's user 
14311 gold badge22 silver badges99 bronze badges

When there is no Indexdocument in a directory Apache httpd cannot display
anything. The typical alternative for Apache, to display a directory
listing
instead, has been disabled by setting -Indexes in the Options.