M
M
maxtrelle2017-02-02 12:41:09
Nginx
maxtrelle, 2017-02-02 12:41:09

How to redirect a subdomain to a local server in nginx by ip?

You need to redirect the subdomain to the server in the local network in nginx.
Tried:

server {
        listen 80;          
        server_name test.example.com www.test.example.com;                                                                                                                                                                    
                                                                                                                                            
        location / {                                                                                                                        
                proxy_pass http://10.0.0.9:80;                                                                                                   
                proxy_set_header Host internal.example.com.local;                                                                                               
                proxy_set_header X-Real-IP $remote_addr;                                                                                    
                proxy_set_header If-Modified-Since $http_if_modified_since;                                                  
        }                                                                                                                                   
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxtrelle, 2017-02-05
@maxtrelle

The problem was in the cache. After clearing the cache everything worked. Thanks - Andrey Burov for the hint.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question