I have a django project and want to deploy it using gunicorn and nginx.
So far everything works, but when I add subdomains, static files are not served and my page look terrible!
If I use localhosts instead, everything works perfect!
Here I leave my nginx.conf:
server {
listen 80 default;
client_max_body_size 4G;
server_name mytest.dev;
keepalive_timeout 5;
# path for static files
root /Users/danielrodriguez/workspace/mtt/static;
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:8000;
}
}
I also have this in my hosts file:
127.0.0.1 localhost
127.0.0.1 mytest.dev
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
How can I make nginx to work as it does when I type "localhost" in my browser when I type "mydev.test"? Pretty much all I want to do is serve a bunch of sites within the same physical server using something like virtualhosts in apache.
PD: I'm also using OS Lion in case it helps.

所有评论(0)