title: inginx fails when attempting www to no-www
body: <p>I'm deploying a website with a jar file. This is my first server that I've set up, so I'm a bit lost on what to do here. I have this in my nginx.config: </p>
  
  <pre><code>server{
       listen          80;
       server_name     www.mySite.com;
       return          301 $scheme://mySite.com$request_uri;
  }
  
  server {
       listen       80;
       server_name  mySite.com;
  
        location / {
             proxy_pass http://localhost:3000 ;
        }
  
        .....
  </code></pre>
  
  <p>I set up the CNAME according to the documentation. </p>
  
  <p>I've tried several resources to straighten this out: </p>
  
  <p><a href="http://nginx.org/en/docs/http/converting_rewrite_rules.html" rel="nofollow noreferrer">http://nginx.org/en/docs/http/converting_rewrite_rules.html</a></p>
  
  <p><a href="https://stackoverflow.com/questions/7947030/nginx-no-www-to-www-and-www-to-no-www">Nginx no-www to www and www to no-www</a></p>
  
  <p><a href="http://rtcamp.com/wordpress-nginx/tutorials/nginx/www-non-www-redirection/" rel="nofollow noreferrer">http://rtcamp.com/wordpress-nginx/tutorials/nginx/www-non-www-redirection/</a></p>
  
  <p>And keep getting the same error: </p>
  
  <pre><code>$ systemctl status nginx.service
  nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
     Active: failed (Result: exit-code) since Fri 2013-09-27 06:22:30 UTC; 11s ago
    Process: 4492 ExecStop=/usr/bin/nginx -g pid /run/nginx.pid; -s quit (code=exited, status=1/FAILURE)
    Process: 3705 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 4495 ExecStartPre=/usr/bin/nginx -t -q -g pid /run/nginx.pid; daemon on; master_process on; (code=exited, status=1/FAILURE)
   Main PID: 3706 (code=exited, status=0/SUCCESS)
     CGroup: name=systemd:/system/nginx.service
  </code></pre>