Install nginx pagespeed on DigitalOcean with serverpilot

220 views
Skip to first unread message

Maurice Tadros

unread,
Jan 24, 2017, 6:20:47 PM1/24/17
to ngx-pagespeed-discuss
Hello all,


/etc/nginx-sp/vhosts.d/APPNAME.d/pagespeed.conf

with the following content (replace APPNAME with the name of your app)

pagespeed on;
pagespeed FileCachePath /var/cache/pagespeed;

# Ensure requests for pagespeed optimized resources go to the pagespeed
# handler and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
location /ngx_pagespeed_statistics { deny all; }
location /ngx_pagespeed_global_statistics { deny all; }
location /ngx_pagespeed_message { deny all; }
location /pagespeed_console { deny all; }

Then, restart Nginx by running the following command as root:

sudo service nginx-sp restart

You can verify PageSpeed is enabled by looking for the X-Page-Speed response header:

curl -s -I http://YOUR_DOMAIN/ | grep X-Page-Speed




There is nothing in the curl.

So then I tried:


bash <(curl -f -L -sS https://ngxpagespeed.com/install) \
     --nginx-version latest

I got the error 

./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.


Error: Failure running './configure --add-module=/root/ngx_pagespeed-latest-stable', exiting



I am not very good with server stuff.  Any suggestions?






Otto van der Schaaf

unread,
Jan 25, 2017, 11:10:23 AM1/25/17
to ngx-pagespeed-discuss
Can you execute the following on the shell to manually install pcre and try again?:
sudo apt-get install libpcre3 libpcre3-dev

These should actually already have been installed via the script you ran though:

If this also fails, can you post the commands you ran and the output they gave?

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.

Maurice Tadros

unread,
Jan 25, 2017, 3:49:25 PM1/25/17
to ngx-pagespeed-discuss
Thanks Otto.  It was my problem.  I refollowed the directions provided by serverpilot and it worked fine.

Thanks for your time
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages