D
D
dobromin2015-10-30 13:39:25
Nginx
dobromin, 2015-10-30 13:39:25

NGINX Not passing requests to second site?

Hello!
I can’t figure out what I didn’t finish, but in general I would like to know how to diagnose the problem.
The second apache server is configured to receive on port 1080 (telnet works the site opens both by ip and name) domain name tes1.ru
The third apache server is configured to receive on port 1180 (telnet works the site opens by both ip and name) domain name test2.ru
The first nginx server is configured (by the name test1.ru the transition is all OK, by the name test2.ru yandex the browser writes "a cyclic redirect was detected on the page" IE "Cannot display this page" The
error log in Apache is empty,
the network in which the servers are 10.20 .1.0
test1 10.20.1.2
test2 10.20.1.3
nginx 10.20.1.5
telnet from nginx to addresses on ports "port 1080" "name test1" "sp 10.20.1.2" and "port 1180" "name test2" "sp 10.20.1.3" all successful!
I don’t even know what to do and how to track and monitor too, since this is completely green.
nginx config


user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
#include /etc/nginx/naxsi_core.rules;
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

Config in nginx site test1.ru (test2.ru is identical, except for natural changes, this is the port name ip)

server {
listen 80;
index index.html index.php;
server_name test1.ru www.test1.ru;
location / {
proxy_pass 10.20.1.2:1080/;
proxy_set_header Host 10.20.1.2;
proxy_set_header
X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
#location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|html|txt)$ {
#root /var/www/wordpress/;
#}
}

I don’t know if I did nginx debug
correctly or not, but I didn’t upload the debug here, it’s rather big.
you can see here

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Viktor Taran, 2015-10-30
@shambler81

Wait, where do you have a second server here at all?
you have proxy_pass 10.20.1.2:1080/; and that's it, where does the second server come from?

http {
    upstream myapp1 {
        server srv1.example.com;
        server srv2.example.com;
        server srv3.example.com;
    }

    server {
        listen 80;

        location / {
            proxy_pass http://myapp1;
        }
    }
}
    }

Where are you at all?

N
nonname, 2015-10-30
@nonname

In a good way, in proxy_pass, the scheme is usually passed. Like this "proxy_pass http://10.20.1.2:1080; "

D
dobromin, 2015-10-30
@dobromin

in general, I noticed that on the site2 server there is no symlink to the default site, this is in case other hosts do not work, as I understand it is useful.
So, having turned on the default, I found that now when it is accessed by the name site2.ru, it redirects to the default site. The default site listens on the same port. Damn, well, what kind of Mr. well, what did I do wrong? how to make Apache work correctly with several hosts and address it by name and not by ip, respectively.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question