Django 403 Ошибка запрещенного разрешения на Linode даже после назначения правильного разрешения для всех файлов в Apache2 - PullRequest
0 голосов
/ 24 октября 2019

Я пытался разместить свой сайт Django на Linode. Такова моя иерархия проектов. Я не трогал мой файл etc / apache2 / apache2.conf.

/
-->root
    |-->Intranet(Project folder)
            |-->Intranet
                    |-->wsgi.py

Даже после предоставления всех необходимых разрешений я получаю ошибку разрешения 403. Куда я не так с файлами конфигурации?

Мой 000-default.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

        # 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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

        Alias /static /root/Intranet/static
        <Directory /root/Intranet/static>
                Require all granted
        </Directory>

        Alias /media /root/Intranet/media
        <Directory /root/Intranet/media>
                Require all granted
        </Directory>

        <Directory /root/Intranet/Intranet>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        WSGIScriptAlias / /root/Intranet/Intranet/wsgi.py
        WSGIDaemonProcess intranet python-path=/root/Intranet python-home=/root
        WSGIProcessGroup intranet

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Это то, что я запустил после редактирования файла 000 conf.

chmod 664 Intranet/db.sqlite3
chown :www-data Intranet/db.sqlite3
chown :www-data Intranet
sudo service apache2 restart

Почему я все еще получаю сообщение об ошибке?

Редактировать

journalctl | tail говорит:

Oct 25 05:45:23 localhost sshd[5392]: pam_unix(sshd:auth): check pass; user unknown
Oct 25 05:45:23 localhost sshd[5392]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=118.141.208.166
Oct 25 05:45:25 localhost sshd[5390]: Failed password for invalid user pi from 118.141.208.166 port 45496 ssh2
Oct 25 05:45:25 localhost sshd[5390]: Connection closed by invalid user pi 118.141.208.166 port 45496 [preauth]
Oct 25 05:45:25 localhost sshd[5392]: Failed password for invalid user pi from 118.141.208.166 port 45498 ssh2
Oct 25 05:45:25 localhost sshd[5392]: Connection closed by invalid user pi 118.141.208.166 port 45498 [preauth]
Oct 25 05:47:53 localhost sshd[5543]: Accepted password for root from 157.45.252.91 port 20247 ssh2
Oct 25 05:47:53 localhost sshd[5543]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct 25 05:47:53 localhost systemd[1]: Started Session 3422 of user root.
Oct 25 05:47:53 localhost systemd-logind[552]: New session 3422 of user root.

Редактировать 2

После еще нескольких исследований. Я пытался реализовать. Вот что я получаю сейчас

Oct 25 06:20:52 localhost sshd[7720]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.72  user=root
Oct 25 06:20:58 localhost sudo[7830]:     root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/sbin/service apache2 restart
Oct 25 06:20:58 localhost sudo[7830]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Oct 25 06:20:58 localhost systemd[1]: Stopping The Apache HTTP Server...
Oct 25 06:20:58 localhost apachectl[7836]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
Oct 25 06:21:08 localhost systemd[1]: Stopped The Apache HTTP Server.
Oct 25 06:21:08 localhost systemd[1]: Starting The Apache HTTP Server...
Oct 25 06:21:08 localhost apachectl[7841]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
Oct 25 06:21:08 localhost systemd[1]: Started The Apache HTTP Server.
Oct 25 06:21:08 localhost sudo[7830]: pam_unix(sudo:session): session closed for user root

Редактировать 3

Мой журнал ошибок Apache гласит

[Fri Oct 25 06:25:01.807836 2019] [mpm_event:notice] [pid 7858:tid 140346799950784] AH00489: Apache/2.4$[Fri Oct 25 06:25:01.807859 2019] [core:notice] [pid 7858:tid 140346799950784] AH00094: Command line: '$ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
...