简体   繁体   中英

Apache 2.4 giving error "Forbidden You don't have permission to access /static/ on this server" while deploying Django on Fedora

I am new to django and facing this forbidden error while deploying django on apache. I have tried almost all the solutions available on google but still didn't get over this issue.

Currently I am using:

  • Python3.6
  • Apache 2.4
  • Fedora 28

I also tried moving my project into /var/www but that also doesn't work for me.

This is how my httpd.conf file looks:

<VirtualHost *:80>
ServerName rohit.com
DocumentRoot /home/rohit/django_ionic/
ServerAdmin root@localhost


Alias /static /home/rohit/django_ionic/drfx/static
<Directory "/home/rohit/django_ionic/drfx/static">
Options Indexes FollowSymLinks
Allow from all
Require all granted
</Directory>

<Directory /home/rohit/django_ionic/drfx/drfx>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>

WSGIDaemonProcess mysite1 python-path=/home/rohit/django_ionic/drfx:/usr/lib/python3.6/site-packages
WSGIProcessGroup mysite1
WSGIScriptAlias / /home/rohit/django_ionic/drfx/drfx/wsgi.py
WSGIApplicationGroup %{GLOBAL}

<Directory /home/rohit/django_ionic/drfx/drfx/>
<Files wsgi.py>
Allow from all
Require all granted
</Files>
</Directory>
</VirtualHost>

I have also given the chown permissions to my django file folder. One more issue is my user and group is apache and I have seen a alot of solutions using user and group as www-data:www-data. Is that realy making any difference as I have given permissions by using apache:apache.

You are using mixed configurations from version 2.x and 2.4.

From the docs:

So even if mixing configuration is still possible, please try to avoid it when upgrading: either keep old directives and then migrate to the new ones on a later stage or just migrate everything in bulk.

From the docs:

In this example, there is no authentication and all requests are denied.

2.2 configuration:

Order deny,allow
Deny from all

2.4 configuration:

Require all denied

In this example, there is no authentication and all requests are allowed.

2.2 configuration:

Order allow,deny
Allow from all

2.4 configuration:

Require all granted

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM