Skip to content

Instantly share code, notes, and snippets.

@aadshalshihry
Last active July 23, 2018 06:54
Show Gist options
  • Save aadshalshihry/50f93e6ac760e5b664f85a4f37601dc6 to your computer and use it in GitHub Desktop.
Save aadshalshihry/50f93e6ac760e5b664f85a4f37601dc6 to your computer and use it in GitHub Desktop.
Steps of how to setup ngnix server

Setup 1 update & install

sudo apt-get update
sudo apt-get install nginx

Setup 2 Move your website’s static files to the server

replace 198.199.103.100 and jgefroh.com

scp -r * [email protected]:/var/www/jgefroh.com

Setup 3 Configure NGINX to serve your website

location of nginx config

cd /etc/nginx/

There are 2 dir which are important

  1. sites-available: contains individual configuration files for all of your possible static websites.
  2. sites-enabled: contains links to the configuration files that NGINX will actually read and run.
  • Create file inside sites-available
touch default
vim default
  • Add the following
server {
  listen 80 default_server;
  listen [::]:80 default_server;
  root /var/www/index.httl; # location of index page
  index index.html; # name of the index page
  server_name jgefroh.com www.jgefroh.com; | localhost
  location / {
    try_files $uri $uri/ =404;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment