localhost works but server_name times out!

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

localhost works but server_name times out!

rambabuy
I'm new to nginx and I'm trying to learn it fast so that I can use it in a
work project.
But I have a weird problem. I have a django project which I run using uwsgi
and I'm trying to use nginx as a reverse proxy for it. It works fine as long
as I access it through localhost:port, but when I use the server name, it
just gets stuck until it times out. There is no error, not even in
/var/log/nginx/error.log.

These are my configurations:

/etc/nginx/conf.d/default.conf:
server {

        listen  9506;

        server_name localhost;
        charset utf-8;

        client_max_body_size 75M;

        location / {
                root
/home/user/shayan/Desktop/djangoProjects/user_management;
                uwsgi_pass
unix:/home/shayan/Desktop/djangoProjects/user_management/uwsgi-nginx.sock;
                include /etc/nginx/uwsgi_params;
        }

}


/home/shayan/Desktop/djangoProjects/user_management/uwsgi.ini:
[uwsgi]
ini=:base

socket=%duwsgi-nginx.sock
master=true
processes=4

[dev]
ini=:base
socket= :8001

[local]
init= :base
http= :8000

[base]
chmod-socket=666


and this is how I run uwsgi:
uwsgi --wsgi-file user_management/wsgi.py --ini uwsgi.ini

So...what's wrong here?
Thanks

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278385,278385#msg-278385

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

RE: [IE] localhost works but server_name times out!

Jason Whittington
Try adding the server name you are using to the server_name directive. You can specify multiple, e.g:

server_name dog cat dogcat;

Jason


-----Original Message-----
From: nginx [mailto:[hidden email]] On Behalf Of Credo
Sent: Tuesday, February 06, 2018 9:30 AM
To: [hidden email]
Subject: [IE] localhost works but server_name times out!

I'm new to nginx and I'm trying to learn it fast so that I can use it in a work project.
But I have a weird problem. I have a django project which I run using uwsgi and I'm trying to use nginx as a reverse proxy for it. It works fine as long as I access it through localhost:port, but when I use the server name, it just gets stuck until it times out. There is no error, not even in /var/log/nginx/error.log.

These are my configurations:

/etc/nginx/conf.d/default.conf:
server {

        listen  9506;

        server_name localhost;
        charset utf-8;

        client_max_body_size 75M;

        location / {
                root
/home/user/shayan/Desktop/djangoProjects/user_management;
                uwsgi_pass
unix:/home/shayan/Desktop/djangoProjects/user_management/uwsgi-nginx.sock;
                include /etc/nginx/uwsgi_params;
        }

}


/home/shayan/Desktop/djangoProjects/user_management/uwsgi.ini:
[uwsgi]
ini=:base

socket=%duwsgi-nginx.sock
master=true
processes=4

[dev]
ini=:base
socket= :8001

[local]
init= :base
http= :8000

[base]
chmod-socket=666


and this is how I run uwsgi:
uwsgi --wsgi-file user_management/wsgi.py --ini uwsgi.ini

So...what's wrong here?
Thanks

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278385,278385#msg-278385

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

This message contains proprietary information from Equifax which may be confidential. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail [hidden email]. Equifax® is a registered trademark of Equifax Inc. All rights reserved.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: RE: [IE] localhost works but server_name times out!

rambabuy
Sorry, I posted the wrong configuration. I did add the server_name I was
using. I just changed it to localhost to see what happens. But when the
server name was the one I was using, I only got time outs!

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278386,278393#msg-278393

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: [IE] localhost works but server_name times out!

Valentin V. Bartenev-3
On Wednesday 07 February 2018 00:08:03 Credo wrote:
> Sorry, I posted the wrong configuration. I did add the server_name I was
> using. I just changed it to localhost to see what happens. But when the
> server name was the one I was using, I only got time outs!

Are you sure that DNS record points to the right server?

  wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: [IE] localhost works but server_name times out!

rambabuy
If by dns record, you mean uwsgi_pass, then yea, I'm sure. Otherwise
localhost wouldn't work either, but it does.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278386,278408#msg-278408

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: [IE] localhost works but server_name times out!

Francis Daly
On Wed, Feb 07, 2018 at 09:56:15PM -0500, Credo wrote:

Hi there,

> If by dns record, you mean uwsgi_pass, then yea, I'm sure. Otherwise
> localhost wouldn't work either, but it does.

Your client (browser) should resolve the name "www.example.com" to an
IP address that corresponds to the nginx server; and all network control
devices (remote firewalls, local iptables or the like) should allow the
traffic get from your client to the nginx IP:port.

All of that has to happen before nginx gets involved.

Since you can access http://localhost/, but not http://www.example.com/,
the first thing to check is whether your client tries to talk to your
nginx when it asks for http://www.example.com/.

If it doesn't, you must fix things outside of nginx so that it does.

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx