Skip to main content
added 23 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

The config looks great. However, a few points:

  1. If your server responds to both the www and non-www version of the site, just leave a wildcard. So server name should read:

    If your server responds to both the www and non-www version of the site, just leave a wildcard. So server name should read:

    server_name    *.my-site.com;
    
  2. You shouldn't put your configs in /etc/nginx/conf.d. Instead, place them in /etc/nginx/sites-available and then symlink them (ln -s) to /etc/nginx/sites-enabled. So, your /etc/nginx directory should look like:

     /etc/nginx/
         nginx.conf
         sites-available/
         my-site.conf
         my-other-site.conf
         yet-another-site.conf
     sites-enabled/
         my-site.conf -> /etc/nginx/sites-available/my-site.conf
         my-other-site.conf -> /etc/nginx/sites-available/my-other-site.conf
         yet-another-site.conf -> /etc/nginx/sites-available/yet-another-site.conf
    

server_name *.my-site.com;

  1. You shouldn't put your configs in /etc/nginx/conf.d. Instead, place them in /etc/nginx/sites-available and then symlink them (ln -s) to /etc/nginx/sites-enabled. So, your /etc/nginx directory should look like:

    /etc/nginx/ nginx.conf sites-available/ my-site.conf my-other-site.conf yet-another-site.conf sites-enabled/ my-site.conf -> /etc/nginx/sites-available/my-site.conf my-other-site.conf -> /etc/nginx/sites-available/my-other-site.conf yet-another-site.conf -> /etc/nginx/sites-available/yet-another-site.conf

The config looks great. However, a few points:

  1. If your server responds to both the www and non-www version of the site, just leave a wildcard. So server name should read:

server_name *.my-site.com;

  1. You shouldn't put your configs in /etc/nginx/conf.d. Instead, place them in /etc/nginx/sites-available and then symlink them (ln -s) to /etc/nginx/sites-enabled. So, your /etc/nginx directory should look like:

    /etc/nginx/ nginx.conf sites-available/ my-site.conf my-other-site.conf yet-another-site.conf sites-enabled/ my-site.conf -> /etc/nginx/sites-available/my-site.conf my-other-site.conf -> /etc/nginx/sites-available/my-other-site.conf yet-another-site.conf -> /etc/nginx/sites-available/yet-another-site.conf

The config looks great. However, a few points:

  1. If your server responds to both the www and non-www version of the site, just leave a wildcard. So server name should read:

    server_name    *.my-site.com;
    
  2. You shouldn't put your configs in /etc/nginx/conf.d. Instead, place them in /etc/nginx/sites-available and then symlink them (ln -s) to /etc/nginx/sites-enabled. So, your /etc/nginx directory should look like:

     /etc/nginx/
         nginx.conf
         sites-available/
         my-site.conf
         my-other-site.conf
         yet-another-site.conf
     sites-enabled/
         my-site.conf -> /etc/nginx/sites-available/my-site.conf
         my-other-site.conf -> /etc/nginx/sites-available/my-other-site.conf
         yet-another-site.conf -> /etc/nginx/sites-available/yet-another-site.conf
    
Source Link
jsanc623
  • 2.8k
  • 15
  • 22

The config looks great. However, a few points:

  1. If your server responds to both the www and non-www version of the site, just leave a wildcard. So server name should read:

server_name *.my-site.com;

  1. You shouldn't put your configs in /etc/nginx/conf.d. Instead, place them in /etc/nginx/sites-available and then symlink them (ln -s) to /etc/nginx/sites-enabled. So, your /etc/nginx directory should look like:

    /etc/nginx/ nginx.conf sites-available/ my-site.conf my-other-site.conf yet-another-site.conf sites-enabled/ my-site.conf -> /etc/nginx/sites-available/my-site.conf my-other-site.conf -> /etc/nginx/sites-available/my-other-site.conf yet-another-site.conf -> /etc/nginx/sites-available/yet-another-site.conf