Skip to content

Configuring nginx to work with subdomains

Jurre edited this page Jan 14, 2015 · 1 revision

If you're using nginx you can use the following config for subdomains:

In your hosts file (located at /etc/hosts on OSX) add the root and subdomains you want to use:

127.0.0.1 defacto.hours.dev
127.0.0.1 hours.dev

Then in your nginx config: (/usr/local/etc/nginx/nginx.conf when installed through homebrew) add:

    server {
      listen 80;
      server_name *.hours.dev;

      location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        proxy_pass http://0.0.0.0:7000;
      }
    }
Clone this wiki locally