How to Install Nginx on Ubuntu

Nginx

We can also use stacks like LEMP or LNAMP

Prepare System For Installation
apt-get update
apt-get upgrade

Download Pre-Requisites
apt-get install libpcre3-dev build-essential libssl-dev sudo

Download Nginx
cd /opt/
wget http://nginx.org/download/nginx-1.0.0.tar.gz
tar -zxvf nginx-1.0.0.tar.gz
cd /opt/nginx-1.0.0/

Prepare for Compilation
./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-http_ssl_module

Install Nginx
make install

Create dedicated system user
adduser --system --no-create-home --disabled-login --disabled-password --group nginx

Download and Install INIT script
wget https://library.linode.com/web-servers/nginx/installation/reference/init-deb.sh
mv init-deb.sh /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults

Start server
/etc/init.d/nginx start

Leave a comment

Your email address will not be published. Required fields are marked *