Henri
Henri

Reputation: 1013

Removing Nginx and installing Nginx with Pagespeed module

So I just installed a new Linode with Ubuntu 16.04 LTS and I have Nginx 1.10.0 installed

nginx -v
nginx version: nginx/1.10.0 (Ubuntu)

I followed the instruction by google to install a new version of Nginx and add Pagespeed module described here: https://modpagespeed.com/doc/build_ngx_pagespeed_from_source

When I do nginx -v the previous version is still installed and I have a new folder with nginx nginx-1.11.8 ! How do I remove the previous version and install pagespeed ? very confused.

Update

I tried to install a dynamic module and I get this when I recompile:

  sudo make install
    make -f objs/Makefile install
    make[1]: Entering directory '/home/henri/nginx-1.10.0'
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/nginx/sbin' \
    || mkdir -p '/usr/local/nginx/sbin'
test ! -f '/usr/local/nginx/sbin/nginx' \
    || mv '/usr/local/nginx/sbin/nginx' \
        '/usr/local/nginx/sbin/nginx.old'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
test -d '/usr/local/nginx/conf' \
    || mkdir -p '/usr/local/nginx/conf'
cp conf/koi-win '/usr/local/nginx/conf'
cp conf/koi-utf '/usr/local/nginx/conf'
cp conf/win-utf '/usr/local/nginx/conf'
test -f '/usr/local/nginx/conf/mime.types' \
    || cp conf/mime.types '/usr/local/nginx/conf'
cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
test -f '/usr/local/nginx/conf/fastcgi_params' \
    || cp conf/fastcgi_params '/usr/local/nginx/conf'
cp conf/fastcgi_params \
    '/usr/local/nginx/conf/fastcgi_params.default'
test -f '/usr/local/nginx/conf/fastcgi.conf' \
    || cp conf/fastcgi.conf '/usr/local/nginx/conf'
cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
test -f '/usr/local/nginx/conf/uwsgi_params' \
    || cp conf/uwsgi_params '/usr/local/nginx/conf'
cp conf/uwsgi_params \
    '/usr/local/nginx/conf/uwsgi_params.default'
test -f '/usr/local/nginx/conf/scgi_params' \
    || cp conf/scgi_params '/usr/local/nginx/conf'
cp conf/scgi_params \
    '/usr/local/nginx/conf/scgi_params.default'
test -f '/usr/local/nginx/conf/nginx.conf' \
    || cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/logs' \
    || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/logs' \
    || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' \
    || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' \
    || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/modules' \
    || mkdir -p '/usr/local/nginx/modules'
test ! -f '/usr/local/nginx/modules/ngx_pagespeed.so' \
    || mv '/usr/local/nginx/modules/ngx_pagespeed.so' \
        '/usr/local/nginx/modules/ngx_pagespeed.so.old'
cp objs/ngx_pagespeed.so '/usr/local/nginx/modules/ngx_pagespeed.so'
make[1]: Leaving directory '/home/henri/nginx-1.10.0'

However I do not see the module!
nginx -V output:

nginx version: nginx/1.10.0 (Ubuntu)
built with OpenSSL 1.0.2g  1 Mar 2016
TLS SNI support enabled

configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --add-module=/build/nginx-pzhfc2/nginx-1.10.0/debian/modules/nginx-auth-pam --add-module=/build/nginx-pzhfc2/nginx-1.10.0/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-pzhfc2/nginx-1.10.0/debian/modules/nginx-echo --add-module=/build/nginx-pzhfc2/nginx-1.10.0/debian/modules/nginx-upstream-fair --add-module=/build/nginx-pzhfc2/nginx-1.10.0/debian/modules/ngx_http_substitutions_filter_module

Upvotes: 0

Views: 2047

Answers (3)

oschaaf
oschaaf

Reputation: 271

For building a binary compatible version of ngx_pagespeed.so (dynamic module) you may have to add --with-cc-opt="-DNGX_HTTP_HEADERS"' to nginx's configure line. The output of nginx -V will not hint at that, but the official stable ppa seems to requires it (I checked 1.12.1).

For more context, see https://github.com/pagespeed/ngx_pagespeed/issues/1440#issuecomment-315520779

Otto

Upvotes: 2

Henri
Henri

Reputation: 1013

After 2 days... I finaly found what I did wrong. When following the instruction you need to reconfigue nginx with the same extensions that was in your current version (nginx -V will give you all the installed extensions). Once you add the dynamic module, you can include it in your file as per instruction.

Upvotes: 0

Faisal Memon
Faisal Memon

Reputation: 1107

apt-get remove nginx should remove the version you installed from the Ubuntu repository.

As an alternative, I suggest to install pagespeed as a dynamic module using the -m option. That way you can keep the NGINX you installed from Ubuntu and just compile and load in pagespeed. Full instructions are on this page.

Upvotes: 0

Related Questions