fake development environment with nginx
install from Homebrew:
"homebrew/nginx" formulae renamed to "denji/homebrew"
$ brew tap denji/nginx
$ brew install nginx-full --with-subs-filter-module
If you get an error "Error: Formulae found in multiple taps:"
$ brew untap homebrew/nginx
$ brew tap denji/nginx
$ brew install nginx-full --with-subs-filter-module
download config file:
$ curl -L https://raw.githubusercontent.com/tsukurite/fake-dev/master/fake-dev.conf -o ~/.fake-dev.conf
execute in webroot
directory's hierarchy. execute below:
$ cd /path/to/app
$ nginx -p . -c ~/.fake-dev.conf
press Ctrl-c
to exit.
easily execute with fake-dev
alias:
$ echo 'alias fake-dev="nginx -p . -c ~/.fake-dev.conf"' >> ~/.bashrc
$ cd /path/to/app
$ fake-dev
Start server with a specific port:
cat << EOS >> ~/.bashrc
function fake-dev-port () {
sed -e "s/127.0.0.1:8080/127.0.0.1:\$1/g" ~/.fake-dev.conf > ~/.fake-dev.temp.conf
nginx -p . -c ~/.fake-dev.temp.conf
}
EOS
The MIT license. Please see top of fake-dev.conf
.