Nginx proxy for GitHub page?

We have a blog where we host github with Jekyll; he is: http://blog.superfeedr.com

Ideally, I want it to be http://superfeedr.com/blog/ , because we need to add AJAX, and we need to avoid the "origin of the" Politics ".

We use Nginx on our "main" web server, and I have the following setup:

location /blog/ {

proxy_pass http://blog.superfeedr.com/;
    proxy_redirect     off;
    proxy_max_temp_file_size 0;

    client_max_body_size       10m;
    client_body_buffer_size    128k;

    proxy_connect_timeout      90;
    proxy_send_timeout         90;
    proxy_read_timeout         90;

    proxy_buffer_size          4k;
    proxy_buffers              4 32k;
    proxy_busy_buffers_size    64k;
    proxy_temp_file_write_size 64k;
}

Unfortunately, as you can see if you go to http://superfeedr.com/blog/ , this clearly does not work. Oddly enough, we are redirected to the Github homepage.

PS: , , , , , ...

+3
2

-, nginx Host blog.superfeedr.com. :

proxy_set_header   Host                    blog.superfeedr.com;
proxy_set_header   X-Host                 blog.superfeedr.com;
proxy_set_header   X-Real-IP             $remote_addr;
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

-, url. - nginx, . , 0.6.x(0.6.32 ) :

    location /blog {
                rewrite  ^/blog(.*)$ /$1 last;
                error_page 402 = @blog;
                return 402;
    }
    location @blog {
        proxy_pass http://blog.superfeedr.com;

        # the rest of proxying parameters should be here

         proxy_set_header   Host                    blog.superfeedr.com;
         proxy_set_header   X-Host                 blog.superfeedr.com;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    }

, (css, ..),

location /css {
    error_page 402 = @blog;
    return 402;
}

0.7.59:

        location /blog {
                set $blog 1;
                rewrite  ^/blog(.*)$ /$1 last;
        }
        location /css {
                set $blog 1;
                error_page 402 = @blog;
                return 402;
        }
        location / {
                if ($blog) {
                        error_page 402 = @blog;
                        return 402;
                }
                # here is where default settings for / should be
                root /usr/local/www/nginx/;
        }
        location @blog {
                proxy_pass http://blog.superfeedr.com;

                # the rest of proxying parameters should be here

                proxy_set_header   Host                   blog.superfeedr.com;
                proxy_set_header   X-Host                 blog.superfeedr.com;
                proxy_set_header   X-Real-IP $remote_addr;
                proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        }
+5

( nginx) DNS. , DNS URL.

, hover.com blog A 64.99.80.30 DNS, "" blog http://superfeedr.com/blog/

dnsimple.com , blog URL http://superfeedr.com/blog/

, , URL- https://.

0

Source: https://habr.com/ru/post/1711474/


All Articles