I have my Django Server running on a virtual maschine. I got my own domain and want to access the server just with the domain via Nginx. I got to files in the sites-enabled folder. The problem is that if I try to connect to the Server I get a 403 forbidden message. But if I change the servername from the Reversed Proxy to my static ip I can access the server. Does anybody know what the mistake is, that I can access the Djangoserver just with my domain?
server{
server_name www.mmjtech.de;
root /var/www/html;
location / {
index index.html index.htm index.html inde.php;
try_files $uri $uri/ = 404;
}
listen 80;
listen [::]:80;
}
And the following is the second file.
server {
listen 80;
server_name mmjtech.de;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http://127.0.0.1:8000 http://mmjtech.de;
}
# location /static/ {
# root /home/myuser/myproject;
# }
}