Sarathlal N

Install & configure a basic nginx server on Debian 8 for static website hosting

This server configuration is only for static website hosting. No application like PHP, MySql etc. The below configured server only serve HTML, CSS & javascript files.

Install Nginx

sudo apt-get install nginx

Configure Server

In Nginx server, blocks are the equivalent of Apache’s virtual hosts. So create the server block file /etc/nginx/sites-available/

In this and all following steps, replace with our domain name.

Create a new configuration file

touch /etc/nginx/sites-available/

Edit configuration file

sudo nano /etc/nginx/sites-available/

Update the content

server {
listen   80;
access_log /var/www/html/;
error_log /var/www/html/;

location / {
	root   /var/www/html/;
	index  index.html index.htm;

Create the public_html and log directories referenced above:

sudo mkdir -p /var/www/html/{public_html,logs}

Enable the site and restart the web server.

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled
sudo systemctl restart nginx
sudo rm /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Need Help?

Do you need any help on Managing Server? I'm happy to help you.

Contact Now

Fill the form & submit your query. I will get back to you soon.

Recent Posts

  1. Get variation product data on selecting variation options - WooCommerce
  2. Add TinyMCE WYSIWYG (Rich text area) meta box - WordPress
  3. Reorder product tabs in single product page - WooCommerce
  4. Download webpage for offline reading - wget
  5. Remove product tabs in single product page - WooCommerce

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about them, please get in touch.