Question

Meteor/Nginx on Ubuntu 16.04 forcing non-www to https

Hiyas, I’m following this tutorial - https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59 - to point my godaddy domain - gamengineers.co to a meteor app deployed to a DO droplet. I’m also using mupx to deploy the meteor app - https://github.com/arunoda/meteor-up/tree/mupx.

Whatever I do, whenever I type in gamengineers.co, it takes me to https://www.gamengineers.co. Now I did add 2 A records to my DO domain, @ to ip, and www to ip.

Here’s my nginx vhost -

server {
  listen        80;
  server_name   gamengineers.co;
  access_log    /var/log/nginx/app.dev.access.log;
  error_log     /var/log/nginx/app.dev.error.log;

  location / {
    proxy_pass http://107.170.46.136:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
  }
}

And I added to this nginx default -

# redirect www to non-www
server {
    listen 80;
    # to redirect all subdomains use *.yourdomain.com instead of www.yourdomain.com
    server_name *.gamengineers.co;
    return 301 http://gamengineers.co$request_uri;
}

When I run curl -I gamengineers.co - I get -

 curl -I gamengineers.co
HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Sun, 22 May 2016 06:50:28 GMT
Connection: keep-alive
Location: https://gamengineers.co/
Access-Control-Allow-Origin: *

Kinda lost and chasing my tail now, anyone see something that makes sense?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @ghostrunners,

It looks like you may have already resolved the problem, but let us know if you haven’t and if you need any further assistance!