Setup nginx to serve site.
How to add a new nginx site
This post lists the step I use to set up sites under using Nginx. As a long time user of Apache web server, I am still new to setting up things under Nginx, and having the steps to follow will save me from having to look up the information each time.
Setup Steps
- Make a directory structure under /var/www for the site files.
- Make sure permissions are correct.
- Create an index page, index.html in /var/www/sitename/html/.
- Create a server block for Nginx that references the index and directory structure for sitename that were created previously by creating a file named sitename in /etc/nginx/sites-available.
- Enable created server block configuration file by creating symbolic link to it under /etc/nginx/sites-enabled.
- Ensure nginx.conf has server_names_hash_bucket_size line uncommented and set to 64.
- Test the Nginx configuration.
- Restart nginx.