Enable nginx by query (not working?)

46 views
Skip to first unread message

Миша Северный

unread,
May 23, 2016, 3:53:29 AM5/23/16
to ngx-pagespeed-discuss
Hello to all!

Is there a way to enable pagespeed module in nginx by query?

I saw that in apache it can be enabled or disabled by query. F.i. www.site.com/?PageSpeed=on

In this case in config apache pagespeed must be set to "off". In Apache "off" mean that module can be enable by url query.

Ok. But in Nginx "off" mean that module completely disabled and you cant enable it by query. In apache for completely disabling is third option, in nginx i know only "on" and "off". I read the docs pagespeed module and my question is still.

Its really that in Nginx it is not possible?

P.S. I can "on" module in config and disable module by query. But it is not quite that what i want.

Thank to all for answers.

Otto van der Schaaf

unread,
May 23, 2016, 6:29:22 AM5/23/16
to ngx-pagesp...@googlegroups.com
When there is no server{} block configured where ngx_pagespeed is enabled, you will get the behavior you are seeing. I think that in the following example however, you would get the desired behavior for the server{} block named www.yoursite.com:

server {
   server_name unused;   
   pagespeed on;
}
server {
   server_name www.yoursite.com
   pagespeed off;
}

Perhaps you can create a (temporary) workaround based on adding a server block that has pagespeed enabled but is not used?

I created https://github.com/pagespeed/ngx_pagespeed/issues/1204 to track this, perhaps it should be considered a bug.

Otto



--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
Visit this group at https://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

Миша Северный

unread,
May 24, 2016, 5:29:57 AM5/24/16
to ngx-pagespeed-discuss
Thank for answer! 

I tried to do as you say. 

But for my configuration this does not work:

Add this at the top of configration of my vhost config
 server {
   server_name unused;
   pagespeed on;
}

server {
    server_name www.real_server.com;
    pagespeed off;
}

And I cant see header "X-Page-Speed:" in "Response Headers" if try to do "www.real_server/?PageSpeed=on". When set "pagespeed on;" i see the Pagespeed header. By url "www.real_server/?PageSpeed=off" Pagespeed was disabled.

My version of module is 1.10.33.2-beta,
X-Page-Speed:
1.10.33.2-7600.
Version NGINX=1.8.0

Which version you used?

понедельник, 23 мая 2016 г., 12:29:22 UTC+2 пользователь Otto van der Schaaf написал:
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.

Otto van der Schaaf

unread,
May 27, 2016, 7:20:59 AM5/27/16
to ngx-pagespeed-discuss
Sorry,  I made a mistake. Could you try this? Doing so configures pagespeed as enabled (and parsing html) but not doing any optimizations unless you explicitly enable them on the querystring

server {
    server_name www.real_server.com;
    pagespeed on;
    pagespeed RewriteLevel PassThrough;
    pagespeed InPlaceResourceOptimization off;
}

Otto

Миша Политаев

unread,
May 29, 2016, 1:14:49 PM5/29/16
to ngx-pagesp...@googlegroups.com
Hello Otto!

Just try this. PageSpeed persistent enabled. Even without any query strings.

Seems not work as expected. ​

To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ngx-pagespeed-discuss/c2M80KOqUV0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ngx-pagespeed-di...@googlegroups.com.

Otto van der Schaaf

unread,
May 30, 2016, 5:40:29 AM5/30/16
to ngx-pagesp...@googlegroups.com
Yes with the configuration I suggested pagespeed is enabled, but should not be doing any optimizations - just passing through html. I was hoping that this would help with what you are trying to achieve. Could you describe what you are trying to achieve?

Otto

Миша Политаев

unread,
May 30, 2016, 2:26:41 PM5/30/16
to ngx-pagesp...@googlegroups.com

Hey Otto!

I dont know exact what our developers to achieve. My aim is that Google Pagespeed can be enabled by query and any modules too . But by default it must disabled and not any changes in pages, like the PageSpeed no enanled.

I see that not need to type PageSpeed=on (behaviour not changed when i type it, modules work same as without it), just only PageSpeedModules=[comma separated list of modules which would like to enable and/or disanle]. Am i right?

30 мая 2016 г. 11:40 пользователь "Otto van der Schaaf" <osc...@we-amp.com> написал:

Otto van der Schaaf

unread,
May 30, 2016, 3:41:38 PM5/30/16
to ngx-pagesp...@googlegroups.com
That sounds mostly right, only instead of  ?PageSpeedModules= you would need ?PageSpeedFilters=
Otto

Миша Политаев

unread,
May 30, 2016, 3:52:21 PM5/30/16
to ngx-pagesp...@googlegroups.com
Oh, sorry, my typo. Of course "PageSpeedFilters".
Reply all
Reply to author
Forward
0 new messages