NGINX

Start with a basic install and configuration:

sudo apt update
sudo apt -y install nginx
sudo sed -i 's/# server_tokens off;/server_tokens off;/g' /etc/nginx/nginx.conf
sudo service nginx start

Test that it's working (should see “Welcome to nginx!”)

sudo /bin/rm /etc/nginx/sites-enabled/default
sudo service nginx stop

Most servers don't serve static content and therefore need to add an application engine to produce the content:

After the application engine is setup/configured or an application engine is not needed, I prefer to configure each site with the configuration it needs by putting each web site/application in a separate configuration file named by the URL then enable it, test the configuration. for example:

sudo ln -s /etc/nginx/sites-available/url.domain.tld /etc/nginx/sites-enabled/url.domain.tld
sudo service nginx configtest

Finally, reload the web server configuration:

sudo service nginx reload

Other NGINX Articles



Last Updated: February 7, 2019