Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

428
Visualizações
MOD_WSGI Apache2 You don't have permission to access this resource

I am working on deploying a Django project with apache2 and MOD_WSGI. When I run the server, I am unable to access the website and I get the error on the site,

Forbidden
You don't have permission to access this resource.
Apache/2.4.29 (Ubuntu) Server at testnexusstudy.com Port 8081

enter image description here I have set up everything I think I need like the conf file,

<VirtualHost *:8081>

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html


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

#Include conf-available/serve-cgi-bin.conf

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

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


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

WSGIScriptAlias / /root/StudBud1/StudBud1/wsgi.py
WSGIDaemonProcess StudBud1 python-path=/root/StudBud1
WSGIProcessGroup StudBud1


</VirtualHost>

I have given all the permissions I thought were required for apache and here is my ls -la

drwxrwxr-x 12 root www-data  4096 Apr  5 19:36 StudBud1
-rw-rw-r--  1 root www-data 204800 Apr  5 19:36 db.sqlite3

Hopefully, some of you have experience with this type of error.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I wouldn't use or give root access to your web server for security reasons.

I would create a user that only has access to the www-data group, make sure apache is also in that group.

Some of these commands come from the Fedora distro, so they may be a little different from Debian.

$ adduser deploy
$ vim /etc/group

In /etc/group:

www-data:x:1003:apache,deploy

/location/to/vhosts/website.conf (extraneous settings removed for clarity)

<VirtualHost *:80>

    Alias /static/ /srv/vhosts/mywebsite/static/
    Alias /media/ /srv/vhosts/mywebsite/media/
    Alias /robots.txt /srv/vhosts/robots.txt

    <Directory /srv/vhosts/mywebsite/path/to/django/configs>
        Require all granted
    </Directory>

    <Directory /srv/vhosts/mywebsite/static>
      Require all granted
    </Directory>

    <Directory /srv/vhosts/mywebsite/media>
      Require all granted
    </Directory>

    <Location "/robots.txt">
      SetHandler None
      Require all granted
    </Location>

    WSGIDaemonProcess mywebsite python-home=/srv/vhosts/mywebsite/.venv python-path=/srv/vhosts/mywebsite/
    WSGIProcessGroup mywebsite
    WSGIScriptAlias / /srv/vhosts/mywebsite/path/to/django/configs/wsgi.py

</VirtualHost>

Then restart apache

Once that is done, make sure to give your directories to the user and group www-data as sudo (-R for recursive)

$ sudo chown -R deploy:www-data /path/to/webroot
over 4 years ago · Santiago Trujillo Relatório

0

I'm a total beginner. On a fresh install I had to set the permissions for the /var/www/html directory. By default they were -rw------- I typed sudo chmod 775 * and it fuctionned.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda