I am using Django with Nginx and Gunicorn.
When I type in https://DomainName[dot]com in the browser below is the message that I get.
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8001/
Can some one please suggest why is the request URL different to the url typed in browser (https://DomainName[dot]com). I would really appreciate your help.
Below is my 'Nginx' server configuration for my domain.
server {
listen 80;
server_name DomainName[dot]com;
access_log off;
# root /opt/myenv/projects/myproject;
location /static/ {
alias /opt/myenv/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
Below is my Gunicorn Configuration
command = '/opt/myenv/bin/gunicorn'
pythonpath = '/opt/myenv/projects/myproject'
bind = '127.0.0.1:8001'
workers = 3
user = 'nobody'
EDIT:
Below are a few of the configurations that I've tried:
Setting the proxy_pass (within my server block) and bind setting in my Gunicorn configuration to 'http://mydomain[dot]com' and When I visit the url I get
500 Internal Server Error
When I check the Error logs for Nginx, below are what I get:
[alert] 16730#0: *766 768 worker_connections are not enough while connecting to upstream, client: 192.241.xxx.xxx, server: mydomain.com, request: "GET / HTTP/1.0", upstream: "http://192.241.xxx.xxx:80/", host: "mydomain[dot]com"
[error] 16870#0: *7 open() "/opt/myenv/static/assets/jqm/js_css/images/ajax-loader.gif" failed (2: No such file or directory), client: 183.82.xxx.xx, server: mydomain.com, request: "GET /static/assets/jqm/js_css/images/ajax-loader.gif HTTP/1.1", host: "www.mydomain[dot]com", referrer: "http://www.mydomain[dot]com/home/"
Setting the proxy_pass (within my server block) and bind setting in my Gunicorn configuration to 'http://mydomain[dot]com:8001' and When I visit the url I get
Page not found (404) Request Method: GET Request URL: http://mydomain[dot]com:8001/
What I am trying to achieve is a way to set my request url to 'http://mydomain.com' so that, When I enable OAuth2 for Facebook authentication, the request url is inline with the app's domain setting in Facebook.
Note: For indicating'.' I've used [dot], as Server fault doesn't allow users with less than 10 reputation to post more than 2 links.