I have a ubuntu server hosting my application, which consists of a front-end made with angular, and an API made with django.
When I try to upload images through the API, I get the error: [Errno 13] Permission denied: '/photos'
I tried setting permissions to 644/755, full read & write permissions to the directory, I also tried creating groups and giving www-data control to the directory...but nothing worked so far.
I'm using Apache2 with mod_wsgi to serve my django app. Here is the folders structure:
/var/www/html/api
│ manage.py
│ passenger.wsgi
│ requirements.txt
│
│───photos (this is the related directory)
│
└───apiX
│ │ serializers.py
│ │ views.py
│ │ ........
│ │
└───apiMain
│ asgi.py
│ settings.py
│ wsgi.py
Here is my /etc/apache2/apache2.conf settings:
# Django app config!
WSGIScriptAlias /api /var/www/html/api/apiMain/wsgi.py
WSGIPythonHome /var/www/html/api/venv
WSGIPythonPath /var/www/html/api/venv/lib64/python3.8/site-packages
WSGIDaemonProcess x_api python-home=/var/www/html/api/venv python-path=/var/www/html/api
WSGIProcessGroup x_api
<Directory /var/www/html/api>
<Files apiMain/wsgi.py>
Require all granted
</Files>
</Directory>
Alias /photos/ /var/www/html/api/photos
Alias /photos /var/www/html/api/photos
<Directory /var/www/html/api/photos>
Require all granted
</Directory>
Thank you!