K
K
komarevtsev2016-07-31 20:24:31
Nginx
komarevtsev, 2016-07-31 20:24:31

What is wrong with nginx config?

my config:

user  nginx;
worker_processes  auto;
worker_rlimit_nofile 65535;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  2048;
    use epoll;
}


http {
  map $http_upgrade $connection_upgrade {
    	default upgrade;
    	''      close;
  }

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;


proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;

client_max_body_size 100m;

    server {
        server_name example.com www.example.com;
 		disable_symlinks if_not_owner;
        listen 80;
    include /etc/nginx/vhosts-includes/*.conf;
 		location ~* \.(jpg|jpeg|gif|png|ico|css|js|ttf)$ {
                root /var/www/public/;
                error_page 404 = 404;
                expires 5h;
        }
        
    location /{
      proxy_pass http://127.0.0.1:4001;
    }
  }
  
  server {
        server_name dev.example.com www.dev.example.com;
 		disable_symlinks if_not_owner;
        listen 80;
    include /etc/nginx/vhosts-includes/*.conf;
 		location ~* \.(jpg|jpeg|gif|png|ico|css|js|ttf)$ {
                root /var/dev/public/;
                error_page 404 = 404;
        }
        
    location /{
      proxy_pass http://127.0.0.1:5001;
    }
  }
}

I want to have a production and a dev version on the same server.
everything is ok at example.com - production opens
at dev.example.com - I get a 502 error.
What could be the reason?
PS on 5001 the application exists and works correctly (example.com:5001) - I get what I need

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lindon_cano, 2016-08-01
@Lindon_cano

> on 5001 the application exists and works correctly (example.com:5001) - I get what I need
And what interface is it listening to?
Maybe it's not listening to your localhost, that's dupa?
look/show

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question