If You Use Debian Jessie, You Can Install Nginx with pagespeed With One Command Without the Need to Build From Source. Here is For HP Cloud. Previously, we talked about installing Nginx Cache Purge module in one command, here is another easy way for avoiding building from source. It is Nginx-Extras for Debian Jessie and the source is dot deb.
Install Nginx with pagespeed With One Command : HP Cloud Vs Non-HP Cloud
We tested with HP Helion Cloud’s Debian Jessie. It is not possible to say whether your hosting provider will supply a custom distribution which may not work as intended. This Google pagespeed does not need any special command to start or stop – restarting nginx does the work. Here is an example screenshot of the header after you’ll complete this guide :
Steps to Install Nginx with pagespeed With One Command on HP Cloud, Debian
Add dot deb to your sources.list
file, open it first :
---
1 | nano /etc/apt/sources.list |
Add these two lines :
1 2 | deb http://packages.dotdeb.org jessie all deb-src http://packages.dotdeb.org jessie all |
If you are using other version than Jessie, you should read here :
1 | https://www.dotdeb.org/instructions/ |
Fetch and install GNUPG :
1 2 | wget https://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg |
Run update & upgrade :
1 | apt update -y && apt upgrade |
Now install Nginx :
1 | sudo apt-get install nginx-extras |
After installation, if you run nginx -V
you will get a huge output, we are making it smaller here :
1 2 3 4 5 6 7 8 9 10 | nginx version: nginx/1.8.0 built with OpenSSL 1.0.1k 8 Jan 2015 TLS SNI support enabled ... --add-module=/usr/src/builddir/debian/modules/headers-more-nginx-module --add-module=/usr/src/builddir/debian/modules/nginx-cache-purge --add-module=/usr/src/builddir/debian/modules/nginx-push-stream-module --add-module=/usr/src/builddir/debian/modules/nginx-upload-progress --add-module=/usr/src/builddir/debian/modules/ngx_pagespeed ... |
Now open /etc/nginx/nginx.conf
file and add these two lines (before any vhosts, after gzip stanza for example) :
1 2 | pagespeed on; pagespeed FileCachePath /var/ngx_pagespeed_cache; |
Create /var/ngx_pagespeed_cache
and set permission :
1 2 | mkdir -p /var/ngx_pagespeed_cache chown -R www-data:www-data /var/ngx_pagespeed_cache |
Restart Nginx :
1 | service nginx restart |
Now, run a cURL to check the header (15.125.82.100 is our test IP of the server, you should change it), you can see that X-Page-Speed: 1.9.32.4-7251
of pagespeed :
1 2 3 4 5 6 7 8 | curl -I 15.125.82.100 HTTP/1.1 200 OK Server: nginx/1.8.0 Content-Type: text/html Connection: keep-alive Date: Tue, 29 Sep 2015 20:48:19 GMT X-Page-Speed: 1.9.32.4-7251 Cache-Control: max-age=0, no-cache |