Answer the question
In order to leave comments, you need to log in
NGINX: How to give one thing by domain and another by ip?
There is a site on the server, it is shown when entering the domain. When entering the server simply by IP, a standard page from nginx is given. I would like to hang up 2 site and that it was given by ip (instead of the standard one from nginx). I don't understand how to implement it.
upstream my_project {
server unix:/tmp/myproject.sock fail_timeout=0;
}
server {
listen 80;
server_name 100.100.100.100;
}
server {
listen 80;
client_max_body_size 4G;
server_name 100.100.100.100;
access_log /home/myuser/logs/myproject/myproject.nginx..log;
keepalive_timeout 5;
root /home/myuser/projects/myproject/;
location / {
proxy_pass http://100.100.100.100;
}
}
Answer the question
In order to leave comments, you need to log in
server_name may well be an IP, only, in your config, server_name is duplicated in two different server {} blocks. That's probably why it doesn't work.
Alternative - You can specify use server_name _;
( or any other non-existent value ).
And to avoid rebound
standard page from NginX- in one of the blocks (preferably the first one in the config / among the includes, because otherwise there will be problems with SSL later) specify the default_server directive for listen
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question