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-moduleIf 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-moduledownload config file:
$ curl -L https://raw.githubusercontent.com/tsukurite/fake-dev/master/fake-dev.conf -o ~/.fake-dev.confexecute in webroot directory's hierarchy. execute below:
$ cd /path/to/app
$ nginx -p . -c ~/.fake-dev.confpress 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-devStart 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
}
EOSThe MIT license. Please see top of fake-dev.conf.