title: Setting up multiple domains on nginx server
body: <p>I have one nginx server on ubuntu running a single application. I want let multiple domains point to this server.</p>
  
  <p>Currently my /etc/nginx/sites-available/default looks like this:</p>
  
  <p>(website1.com is just an example as I don't want to give out my real domain)</p>
  
  <pre><code>server {
      listen 80 default_server;
      listen [::]:80 default_server;
  
  
      root /var/www/website/public;
      index index.php index.html index.htm;
  
  
      server_name website1.com;
  
      location / {
  
              try_files $uri $uri/ /index.php?$query_string;
      }
  
      location ~ \.php$ {
              try_files $uri /index.php =404;
              fastcgi_split_path_info ^(.+\.php)(/.+)$;
              fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
              fastcgi_index index.php;
              fastcgi_param SCRIPT_FILENAME 
              $document_root$fastcgi_script_name;
              include fastcgi_params;
  
      }
  
  }
  </code></pre>
  
  <p>This works when someone going to website1.com</p>
  
  <p>Now if people coming from website2.com do i just copy the code again exactly and change the server_name?</p>
  
  <p>Or is there anything else I must do?</p>