Trying to install pagespeed module with nginx

These last couple of days I have been banging my head against my keyboard trying to install ngx_pagespeed with nginx.

First couple of times I was trying to install ngx_pagespeed as a dynamic module so maybe I could install it along side an existing nginx (Version: 1.13.4). I am not sure if it’s possible but I have read some forums stating it is. In the forum it said to use this (–dynamic-module) at the end of the automated install instead of (–nginx-version latest) and you should get and then I can put that in the modules folder of nginx and it should work. I have no idea where to find this file after running the automated install.

After some frustration I ran up a test environment to see if I can get the normal install to work, so that would install both nginx and pagespeed. Both times I ran it it gave this error at the end after it saying “Build nginx?”

  /root/ngx_pagespeed-latest-stable/src/ In function ‘ngx_int_t net_instaweb::{anonymous}::ps_preaccess_handler(ngx_http_request_t*)’:
/root/ngx_pagespeed-latest-stable/src/ error: ‘ngx_http_core_try_files_phase’ was not declared in this scope
   while (ph[i + 1].checker != ngx_http_core_try_files_phase &&
objs/Makefile:1323: recipe for target 'objs/addon/src/ngx_pagespeed.o' failed
make[1]: *** [objs/addon/src/ngx_pagespeed.o] Error 1
make[1]: Leaving directory '/root/nginx-1.13.4'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2
Error: Failure running 'make', exiting.

Could this error be coming up because I have nginx already installed?

I am still pretty new to VPS, Ubuntu, nginx etc but I am learning fast. So any help would be greatly appreciated!

Ubuntu version: 16.04 Nginx version: 1.13.4


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.