1. MagicESP
  2. Ubuntu Server 18.04
  3. Install Nginx on Ubuntu 16.04

Install Nginx on Ubuntu 16.04

Synonyms:
  1. Nginx

Install Nginx

sudo apt update && sudo apt install -y nginx

navigate the browser to your server ip will shows the default page.

http://{{ ip.value }}/ 

Here is the file system location of the default page

ls /var/www/html/

Run command as user www-data

The nginx runs as user www-data, we can run command under that user as nginx does

sudo -u www-data whoami
sudo -u www-data php -i | grep _SERVER

Create a special user for site content (optional)

Although I now put all the content under ubuntu account, but it is possible to use a special account

sudo adduser --gecos "" --disabled-password {{ username.value }}
sudo adduser www-data {{ username.value }}

Remove that special user (optional)

sudo deluser --remove-home {{ username.value }}

Generate CSR For SSL Certificate (optional)

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privatekey.key