I was deploying my django app on my VPS using the apache web server.
It works totally fine on http://192.46.209.82:8000/
but when I try to access the same using my IP address, 192.46.209.82
. I get
Forbidden
You don't have permission to access this resource.
Apache/2.4.41 (Ubuntu) Server at 192.46.209.82 Port 80
Here is my conf file
nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /root/django/myproject
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /root/django/myproject/static
<Directory /root/django/myproject/static>
Require all granted
</Directory>
<Directory /root/django/myproject/myproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject python-path=/root/django/myproject python-home=/root/django/myprojectenv
WSGIProcessGroup myproject
WSGIScriptAlias / /root/django/myproject/myproject/wsgi.py
</VirtualHost>
I am using python's virtual environment, where myprojectenv is my virtual env path and the pwd is /root/django
Note : I tried the answer from the question that I was getting as suggestion to this question but that did not work for me.
EDIT : Updated permission
CodePudding user response:
In my case even though I set up all the permission correctly, I still was getting error so I moved my entire project and virtual environment to /opt
and it worked for me for now. But I would like to know the reason why it was not working under /home
even when I gave all permissions