incubator-pagespeed-ngx icon indicating copy to clipboard operation
incubator-pagespeed-ngx copied to clipboard

pagespeed proxy https request ?

Open ygm521 opened this issue 6 years ago • 11 comments
trafficstars

I want to use the nginx pagespeed proxy https request, but my backend has multiple servers, How do I proxy?

pagespeed MapOriginDomain "http://testvser_pool" "https://192.168.44.243:443";

upstream testvser_pool { server 192.168.66.100:80 fail_timeout=10s weight=10; server 192.168.66.101:80 fail_timeout=10s weight=10; server 192.168.66.102:80 fail_timeout=10s weight=10; }

server { listen 192.168.44.243:443 ssl; location / { proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
proxy_pass http://testvser_pool; } }

ygm521 avatar Oct 24 '19 07:10 ygm521

An example, you need to configure more things, like pagespeed file cache and so on....

http {
     upstream testvser_pool {
            server 192.168.66.100:80 fail_timeout=10s weight=10;
            server 192.168.66.101:80 fail_timeout=10s weight=10;
            server 192.168.66.102:80 fail_timeout=10s weight=10;
      }
      server {
           listen 192.168.44.243:443 ssl;
           pagespeed on;
           pagespeed MapOriginDomain "http://testvser_pool" "https://192.168.44.243:443";      
           location / {
           proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
           proxy_pass http://testvser_pool;
       }
}

https://serverfault.com/questions/529197/nginx-reverse-proxy-ssl-offloading-caching-and-pagespeed-all-in-one

Lofesa avatar Oct 24 '19 08:10 Lofesa

This method needs to go once local localhost ,is there any other good method?

ygm521 avatar Oct 25 '19 01:10 ygm521

What do you mean with this: "This method needs to go once local localhost" ? Another way to go is setting pagespeed in the origin server. 1.- user --> nginx + pagespeed --> origin server (yours setting, I think) 2.- user --> nginx --> origin server + pagespeed

Lofesa avatar Oct 25 '19 07:10 Lofesa

i want user --> nginx + pagespeed --> origin server but not used 127.0.0.1 proxy

ygm521 avatar Oct 25 '19 09:10 ygm521

You don´t need to set the origin server at 127.0.0.1, change the references to this IP to the IP you are using in the origin server.

user --> public IP/domain nginx + pagespeed private IP --> Private IP origin server

EDIT: I have deleted the references to the downstream cache.

Lofesa avatar Oct 25 '19 12:10 Lofesa

I really don't want to use pagespeed private IP,i hope : user --> public IP/domain nginx --> Private IP origin server Only in this way can it be widely used。

ygm521 avatar Oct 25 '19 12:10 ygm521

Hi @ygm521 I have wrongly expressed my self. Think in (nginx + pagespeed) like a box, one side of the box open to the world (public ip/domain that the world see) and other side open to the origin server (Private IP).

The Private IP can be a loopback 127.0.0.1 (if both (nginx+pagespeed) and the origin server) run on the same physical machine (so don´t need a physical net card) or can be a 10.0.0.0 or 172.16.0.0 or 192.168.0.0 or 169.254.0.0

Pagespeed is not a separate thing, is a software that runs with nginx (as a module or staticaly linked in the nginx executable) or with apache as a module.

Lofesa avatar Oct 25 '19 18:10 Lofesa

why not http proxy can use: user --> nginx + pagespeed --> origin servers not used private ip

ygm521 avatar Oct 26 '19 01:10 ygm521

why not http proxy can use: user --> nginx + pagespeed --> origin servers , not used private ip

ygm521 avatar Oct 26 '19 01:10 ygm521

Well.... you have a domain name, related to a public IP. The origin server can use another public IP, is not forbiden , but it can be discovered by users and bots then you have a public IP/domain and a public IP that serves the same content => google and other search engines consider that as a duplicate conten, it can be mitigated by the canonical tag, but is better to avoid it. When you use a proxy cache is because you thing the proxy cache response to the final user is more fast than the origin server. Origin server is slow that the proxy cache cause need to "construct" the response vs. the response from the proxy cache is a "constructed" page. Making the origin server accesible by user maibe you loss these aadvantage cause the origin server then need to serve content to the proxy cache and user that discover it.

Lofesa avatar Oct 26 '19 10:10 Lofesa

Back to the original question,i do not want used private ip example like https://serverfault.com/questions/529197/nginx-reverse-proxy-ssl-offloading-caching-and-pagespeed-all-in-one, but want to used nginx + pagespeed,how did i configure? Part of the configuration is as follows, expecting you to give the core configuration of pagespeed. upstream testvser_pool { server 192.168.66.100:80 fail_timeout=10s weight=10; server 192.168.66.101:80 fail_timeout=10s weight=10; server 192.168.66.102:80 fail_timeout=10s weight=10; }

server { listen 192.168.44.243:443 ssl; location / { proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2; proxy_pass http://testvser_pool; } }

ygm521 avatar Oct 28 '19 04:10 ygm521