Skip to content

Instantly share code, notes, and snippets.

@ebaxt
Last active December 19, 2015 16:59
Show Gist options
  • Save ebaxt/5988230 to your computer and use it in GitHub Desktop.
Save ebaxt/5988230 to your computer and use it in GitHub Desktop.
$ brew install nginx
$ cd /user/local/var/www
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/css
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/js
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/less
$ ln -s /Users/ebaxt/Projects/ardoq-front/resources/public/img img
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/html/* ./
$ pwd
/usr/local/var/www
$ www git:(master) ✗ ls -la
total 128
drwxr-xr-x 18 ebaxt admin 612 Jul 12 23:18 .
drwxr-xr-x 6 ebaxt admin 204 Jul 12 18:01 ..
-rw-r--r-- 1 ebaxt admin 537 Jul 12 18:01 50x.html
lrwxr-xr-x 1 ebaxt admin 53 Jul 12 23:16 about.html -> /Users/ebaxt/Projects/ardoq-front/src/html/about.html
lrwxr-xr-x 1 ebaxt admin 48 Jul 12 23:16 ardoq -> /Users/ebaxt/Projects/ardoq-front/src/html/ardoq
lrwxr-xr-x 1 ebaxt admin 52 Jul 12 23:16 base.html -> /Users/ebaxt/Projects/ardoq-front/src/html/base.html
lrwxr-xr-x 1 ebaxt admin 41 Jul 12 23:14 css -> /Users/ebaxt/Projects/ardoq-front/src/css
lrwxr-xr-x 1 ebaxt admin 54 Jul 12 23:16 favicon.ico -> /Users/ebaxt/Projects/ardoq-front/src/html/favicon.ico
lrwxr-xr-x 1 ebaxt admin 52 Jul 12 23:16 home.html -> /Users/ebaxt/Projects/ardoq-front/src/html/home.html
lrwxr-xr-x 1 ebaxt admin 54 Jul 12 23:18 img -> /Users/ebaxt/Projects/ardoq-front/resources/public/img
lrwxr-xr-x 1 ebaxt admin 53 Jul 12 23:16 index.html -> /Users/ebaxt/Projects/ardoq-front/src/html/index.html
lrwxr-xr-x 1 ebaxt admin 40 Jul 12 23:14 js -> /Users/ebaxt/Projects/ardoq-front/src/js
lrwxr-xr-x 1 ebaxt admin 42 Jul 12 23:14 less -> /Users/ebaxt/Projects/ardoq-front/src/less
lrwxr-xr-x 1 ebaxt admin 53 Jul 12 23:16 login.html -> /Users/ebaxt/Projects/ardoq-front/src/html/login.html
lrwxr-xr-x 1 ebaxt admin 51 Jul 12 23:16 nav.html -> /Users/ebaxt/Projects/ardoq-front/src/html/nav.html
lrwxr-xr-x 1 ebaxt admin 56 Jul 12 23:16 newindex.html -> /Users/ebaxt/Projects/ardoq-front/src/html/newindex.html
lrwxr-xr-x 1 ebaxt admin 55 Jul 12 23:16 profile.html -> /Users/ebaxt/Projects/ardoq-front/src/html/profile.html
lrwxr-xr-x 1 ebaxt admin 54 Jul 12 23:16 signup.html -> /Users/ebaxt/Projects/ardoq-front/src/html/signup.html
######## nginx.conf ##########
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location /endpoints/ {
proxy_pass http://127.0.0.1:3000/;
}
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
$ nginx
$ nginx -s reload
@magnulf
Copy link

magnulf commented Jul 12, 2013

Nice takker! Alternativ to er:

location /login/ {
            proxy_pass http://127.0.0.1:3000/login;
        }

        location /endpoints/ {
            proxy_pass http://127.0.0.1:3000/;
        }

        location /css/ {
            root /Users/magnulf/Projects/ardoq-front/src;
        }


        location /js/ {
            root /Users/magnulf/Projects/ardoq-front/src;
        }

        location /less/ {
            root /Users/magnulf/Projects/ardoq-front/src;
        }

        location /img/ {
            root /Users/magnulf/Projects/ardoq-front/resources/public;
        }


        location / {
            root   /Users/magnulf/Projects/ardoq-front/src/html;
            index  index.html index.htm;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment