Forbidden У вас нет разрешения на доступ к этому ресурсу. Apache2 с mod-WSGI django

404 Forbidden Apache/2.4.54 (Debian) Сервер на domainname.com Порт 80

я не могу получить доступ к моему веб-приложению django на сервере. я попробовал почти все возможные решения, но они не работают для меня

  • Django 3.2
  • Apache2 2.4
  • project-directory-path ------> /home/admin/toktobot/chatbot
  • >
  • apache status is ok
  • sudo apt-get install apache2
  • sudo apt-get install libapache2-mod-wsgi-py3

/etc/apache2/sites-available/django_project.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html
#       ServerName domainname.com   # 
#       serverAlias www.domainname.com

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        Alias /static  /home/admin/toktobot/chatbot/static
        <Directory /home/admin/toktobot/chatbot/static>

         Require all granted

        </Directory>    
        <Directory /home/admin/toktobot/chatbot/chatbot>

        <Files wsgi.py>
         Require all granted
        </Files>

        </Directory>



        #WSGIScriptAlias / /home/admin/toktobot/chatbot/chatbot/wsgi.py>
        WSGIDaemonProcess  chatbot  python-path=/home/admin/toktobot/chatbot  python-home=/home/admin/toktobot/chatbot/env
        WSGIProcessGroup chatbot
        WSGIScriptAlias / /home/admin/toktobot/chatbot/chatbot/wsgi.py>


</VirtualHost>


tail /var/log/apache2/error.log

[Thu Sep 29 14:29:39.292866 2022] [authz_core:error] [pid 55185:tid 140068614272768] [client 39.33.233.70:59864] AH01630: client denied by server configuration: /home/admin/toktobot/chatbot/chatbot/wsgi.py>, referer: http://domainname.com/

sudo systemctl status apache2

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-09-29 13:14:52 UTC; 1h 40min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 55177 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 55182 (apache2)
      Tasks: 73 (limit: 1149)
     Memory: 22.2M
        CPU: 648ms
     CGroup: /system.slice/apache2.service
             ├─55182 /usr/sbin/apache2 -k start
             ├─55183 /usr/sbin/apache2 -k start
             ├─55184 /usr/sbin/apache2 -k start
             └─55185 /usr/sbin/apache2 -k start

Sep 29 13:14:52 ip-172-31-83-167 systemd[1]: apache2.service: Succeeded.
Sep 29 13:14:52 ip-172-31-83-167 systemd[1]: Stopped The Apache HTTP Server.
Sep 29 13:14:52 ip-172-31-83-167 systemd[1]: Starting The Apache HTTP Server...
Sep 29 13:14:52 ip-172-31-83-167 systemd[1]: Started The Apache HTTP Server.

разрешение на папку для пользователя и группы

#          project folder permissions
total 4
drwxrwxr-x 7 admin www-data 4096 Sep 28 12:36 chatbot

#          wsgi.py file permission
total 20
-rwxrwxr-x 1 admin www-data    0 Sep 16 10:34 __init__.py
drwxrwxr-x 2 admin www-data 4096 Sep 29 05:08 __pycache__
-rwxrwxr-x 1 admin www-data  391 Sep 16 10:34 asgi.py
-rwxrwxr-x 1 admin www-data 3997 Sep 29 05:08 settings.py
-rwxrwxr-x 1 admin www-data 1036 Sep 23 08:14 urls.py
-rwxrwxr-x 1 admin www-data  391 Sep 16 10:34 wsgi.py


пожалуйста, помогите мне, я работаю 2 дня подряд, но у меня ничего не получилось. Я следил за разными блогами и другими материалами, но у меня ничего не получилось. Спасибо

Вернуться на верх