A command line tool to setup a local domain environment for development using nginx
and dnsmasq
.
Status: Not ready.
```sh TacoDev 0.1.0 Fraser Xu xvfeng123@gmail.com Taco Dev
USAGE: taco_dev [SUBCOMMAND]
FLAGS: -h, --help Prints help information -V, --version Prints version information
SUBCOMMANDS: dnsmasq Set up dnsmasq help Prints this message or the help of the given subcommand(s) nginx Set up NGINX reload Restart nginx ```
dnsmasq
- Dnsmasq provides network infrastructure for small networks: DNS, DHCP, router advertisement and network boot.nginx
- HTTP and reverse proxy server.If you are on Mac and has howebrew
installed, simply run homebrew install dnsmasq nginx
.
dnsmasq
sh
$ taco_dev dnsmasq --domain=test
To verify:
sh
$ ping taco_dev.test
PING taco_dev.test (127.0.0.1): 56 data bytes
nginx
To tell nginx
to proxy a request to port 80
, we need to defined the upstream server. It can be either a local server running on a specific port localhost:8080
or a unix socket object unix:/tmp/example.test
.
sh
$ taco_dev nginx --upstream=127.0.0.1:8000 --server=taco_dev.test --root=/Users/fraserxu/projects/taco_dev;
This will add a taco_dev.conf
in nginx/servers
directory.
```nginx upstream tacodev.test { server unix:/tmp/tacodev; }
server { listen 80; servername tacodev.test; root /Users/fraserxu/projects/taco_dev;
try_files $uri/index.html $uri @taco_dev.test;
location @taco_dev.test {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://taco_dev.test;
}
} ```
sh
$ taco_dev reload
$ open http://taco_dev.test
MIT