1

I just compiled the latest version of Nginx on Ubuntu 15.10 and installed it using

dpkg -i nginx_1.9.15-1_amd64.deb

However, the systemd service script was not created so nginx is not running. How exactly do I do this and what are the proper steps to install nginx after self-compiling so that all of the necessary files are present and in their proper locations?

Thanks!

0

Do not compile nginx yourself unless you absolutely must. In your case there are two possibilities:

  1. Use NGINX Mainline PPA.

    To use PPA, execute commands:

    sudo apt-add-repository ppa:nginx/development
    sudo apt-get update
    sudo apt-get install nginx-extras
    
  2. Since 1.9.11 Nginx supports dynamic modules and they have nginx-module-perl.

    To use nginx's official repository create file /etc/apt/sources.list.d/nginx.list with following lines (wily is codename for Ubuntu 15.10):

    deb http://nginx.org/packages/mainline/ubuntu/ wily nginx
    deb-src http://nginx.org/packages/mainline/ubuntu/ wily nginx
    

    and execute commands:

    wget -qO - http://nginx.org/keys/nginx_signing.key | sudo apt-key add -
    sudo apt-get update
    sudo apt-get install nginx nginx-module-perl
    
  • How would I download and install the dynamic perl module? – Littlebob Apr 26 '16 at 10:11
  • It's in the same repo. But you should not download files manually, instead you hould add nginx's repo and use apt-get/aptitude. – Alexey Ten Apr 26 '16 at 10:13
  • Sorry, I am trying to find this out myself but Google is not my friend today. What are the exact steps needed to install nginx and the perl module? I tried "sudo apt-get install nginx nginx-module-perl" but I get an error message that the perl module (by that name) doesn't exist. – Littlebob Apr 26 '16 at 10:58
  • Installation instructions are on the same pages. – Alexey Ten Apr 26 '16 at 11:35
  • @Littlebob I've added instructions – Alexey Ten Apr 26 '16 at 11:50
1

Have a look at my tutorial. Here's how I build and install Nginx and a few modules. The key part for you is "make install".

cd /home/ec2-user
mkdir nginx-build
cd nginx-build
service nginx stop
yum groupinstall "Development Tools"
yum install pcre-devel zlib-devel openssl-devel
wget http://nginx.org/download/nginx-1.9.11.tar.gz
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
wget https://github.com/openresty/headers-more-nginx-module/archive/v0.29.tar.gz
tar -xzf nginx-1.9.11.tar.gz
tar -xzf ngx_cache_purge-2.3.tar.gz
tar -xzf v0.29.tar.gz
tar -xzf 1.9.32.10.tar.gz    # Google Pagespeed, optional
ngx_version=1.9.32.10
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip   # Google Pagespeed, optional
cd ngx_pagespeed-release-1.9.32.10-beta   # Google Pagespeed, optional
wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz   # Google Pagespeed, optional
cd ../nginx-1.9.9
# Note that I have no idea what the next line does but it was in the official guide
PS_NGX_EXTRA_FLAGS="--with-cc=/opt/rh/devtoolset-2/root/usr/bin/gcc"
# Safe option, slower, lots of modules included
#./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --add-module=/tmp/ngx_cache_purge-2.3 --add-module=/tmp/headers-more-nginx-module-0.29 --with-http_realip_module --add-modeule=../ngx_pagespeed-release-1.9.32.10-beta
# Many plugins removed, extra optimisations including some JUST for the machine it's compiled on
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-threads --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=native' --add-module=../ngx_cache_purge-2.3 --add-module=../headers-more-nginx-module-0.29 --with-http_realip_module --add-module=../ngx_pagespeed-release-1.9.32.10-beta
make && make install
make clean  (NB: optional)
service nginx start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.