I'm trying to redirect my domain url to my local server.
For some reason it work with the localhost (mapping from http://localhost/ to http://127.0.0.1:5000 works), but I can't make it working with my domain name (http://www.example.com)
Here's my nginx conf:
...
server {
listen 80;
server_name www.example.com localhost;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
}
}
...
Is there's something I am missing?
edit
It seems that the problem was about the reolution of 0.0.0.0, localhost and 127.0.0.1 . Rewriting my proxy_pass to http://0.0.0.0:5000 did the trick. Inversely with my server as long as it match exactly the nginx conf.
My error was because I thought 0.0.0.0 / 127.0.0.1 / was interchangeable. Thanks for your help.
add a entry to
/etc/hosts
for your server_name www.example.comits working for localhost because
localhost
is mapped by default in/etc/hosts/
file