Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I deploy Django+uwsgi+Nginx project, but access nginx by works fine, 400 returned if access by IP

The iptables shows

# iptables -L |grep 8181
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:8181 

And Nginx configure is

server {
    listen       8181 default;
    server_name  _;

The access log shows - - [06/Dec/2013:09:55:16 +0800] "GET / HTTP/1.1" 400 - - [06/Dec/2013:10:08:08 +0800] "GET / HTTP/1.1" 200

What reason may cause this issue?

share|improve this question
Have you checked the nginx access logs for the errors? They are normally at /var/log/nginx-error.log – Ramiro Berrelleza Dec 6 '13 at 2:03
@RamiroBerrelleza I update access log – linbo Dec 6 '13 at 2:17
I just noticed that you're using Django. Have you checked that the 400 is not coming from Django or your application? 400 means bad request, which is typically an app-level error. – Ramiro Berrelleza Dec 6 '13 at 3:25

1 Answer 1

According to the nginx documentation on server names you are not supposed to use '_'. Instead, the recommendation is to use the default_server directive:

server {
    listen      80 default_server;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.