I have followed this link for self-signed ssl certificate for nginx.My nginx conf is like below:
server {
listen 80;
server_name myMachineIP;
return 302 https://$server_name$request_uri;
access_log /var/log/nginx/mysite.access.log;
error_log /var/log/nginx/mysite.error.log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static {
alias /home/users/mysite/app/static;
}
}
server {
# SSL configuration
listen 443 ssl http2 myMachineIP;
listen [::]:443 ssl http2 myMachineIP;
include snippets/self-signed.conf;
include snippets/ssl-params.conf;
}
But still I have
Access to 192.168.1.xxx was denied
You don't have authorization to view this page.
HTTP ERROR 403
What is wrong with this configurations? Any help would be appreciated.
The first server block performs a
return 302
so thelocation
blocks it contains are ignored.The second server block contains no
location
blocks, which probably explains the 403 response.Move the
location
blocks from the first server block to the second.See this document for more.