Skip to content

Latest commit

 

History

History
61 lines (54 loc) · 1.24 KB

nginx.md

File metadata and controls

61 lines (54 loc) · 1.24 KB

Add official source file

sudo wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
sudo vi /etc/apt/sources.list.d/nginx.list
deb [arch=amd64] http://nginx.org/packages/mainline/ubuntu/ bionic nginx

Install NGINX 1.17

sudo apt-get update
sudo apt-get install nginx
sudo systemctl enable nginx

Change folder owner

mkdir /var/www
sudo chown -R www-data:www-data /var/www

Edit NGINX Conf

sudo vi /etc/nginx/nginx.conf
worker_processes 1; (auto) #for low traffic
events {
  worker_connections 65536;
  use epoll;
  multi_accept on;
}
http {
  server_tokens off;
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
}

Restart Service

sudo systemctl restart nginx

Set Authentication

openssl passwd
sudo vi /etc/nginx/auth
LOGIN:PASSWORD

Useful Command

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
nginx -t

Reference