• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

118
Views
Django Apache 2.4.18 Ubuntu 403

I am trying to configure my django app with Apache 2.4.18..

I am using Django 3.0.5 and Python 3.8.2., on Ubunu 16.04.

Everything works fine in runserver mode.

Forbidden
You don't have permission to access this resource.

This is my apache config gile

Listen 80
<VirtualHost *:80>
        ServerAdmin xxx@xxx.com
        ServerName servername.net
        DocumentRoot /srv

        Alias /static /srv/tacdb/mysite/static
        <Directory "srv/tacdb/mysite/static">
                 Require all granted
        </Directory>

        Alias /media /srv/tacdb/mysite/media
        <Directory "srv/tacdb/mysite/media">
                Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/portal_error.log
        CustomLog ${APACHE_LOG_DIR}/portal_access.log combined

        WSGIDaemonProcess mysite python-home=/srv/tacdb/virtualenvironment/project_1 python-path=/srv/tacdb
        WSGIProcessGroup mysite
        WSGIScriptAlias / /srv/tacdb/mysite/wsgi.py

        <Directory /srv/tacdb/mysite>
                <Files wsgi.py>
                Require all granted
                </Files>
        </Directory>
</VirtualHost>


configtest is ok and server status is ok.

root@test-tools:~/srv# systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Thu 2020-04-02 15:18:20 UTC; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 26327 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 25036 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
  Process: 26356 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/apache2.service
           ├─26372 /usr/sbin/apache2 -k start
           ├─26375 /usr/sbin/apache2 -k start
           ├─26376 /usr/sbin/apache2 -k start
           └─26377 /usr/sbin/apache2 -k start

Apr 02 15:18:19 test-tools systemd[1]: Stopped LSB: Apache2 web server.
Apr 02 15:18:19 test-tools systemd[1]: Starting LSB: Apache2 web server...
Apr 02 15:18:19 test-tools apache2[26356]:  * Starting Apache httpd web server apache2
Apr 02 15:18:20 test-tools apache2[26356]:  *
Apr 02 15:18:20 test-tools systemd[1]: Started LSB: Apache2 web server.

I have tried to change permisions on the directory for apache user "www-data", but no luck.

I think that the folder level permisions are according to Apache version, based on my research.

Any ideeas?

Thanks a lot! Do let me know if other info is necessary.

about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

In my case it was as simple as granting permision. I have used the /srv/ from another location. I am not sure - security wise - if this is the best solution to gand folder access.

sudo chmod -R 777 /srv

I think i am better now since it reads my configuration file (i have encountered another error).

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error