F
F
Fadey22016-10-10 15:24:33
Nginx
Fadey2, 2016-10-10 15:24:33

How to set up nginxx as a proxy to display another site?

OS ubuntu 16 x64
nginx version: nginx/1.10.0 (Ubuntu)
Task: when entering the IP VPS, what would be displayed the content of the site, for example ya.ru
Googled this topic How to set up site proxying in nginx?
The code

server {
        listen         127.0.0.1 ;

        server_name habrahabr.ru;

        location / {

        proxy_pass http://$http_host$request_uri;
        proxy_set_header Host $http_host;
        resolver 8.8.8.8;

        }


}

I put in /etc/nginx/sites-available file ya.ru
then
ln -s /etc/nginx/sites-available/ya.ru /etc/nginx/sites-enabled/ya.ru turn on the site
nginx serivce restart I
restart the server
Then I do
curl 127.0.0.1
I get the nginx page but not Yandex)))) =
I think it's already the 2nd day, please help me, can the code be wrong? To me though http to configure.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2016-10-10
@SagePtr

And where does Yandex come from?

F
Fadey2, 2016-10-10
@Fadey2

So the meaning is not in Yandex, the proxying script does not work, I tried to do it on facebook at all ...
Can you help for a fee?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question