Skip to content
Generate nginx server configs on a per (rails) app basis
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
nginx_app.rb

README.md

nginx-app

nginx-app was created to configure (new) rails apps in a quick and easy way.

Short setup

nginx, puma (or whatever) with Procfile (foreman).

Why

Because pow is a wonderful idea, but too slow in my expercience.

Install nginx / dnsmasq

brew install nginx
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist

mkdir /usr/local/etc/nginx/sites/

Add the following to /urs/local/etc/nginx/nginx.conf

# Load all vhosts !
include /usr/local/etc/nginx/sites/*.conf;
brew install dnsmasq

echo 'address=/.dev/127.0.0.1' > /usr/local/etc/dnsmasq.conf

sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Create a file /etc/resolver/dev containing:

nameserver 127.0.0.1

Usage

Run nginx-app in the app root.

A nginx server conf (app.dev) will be created which proxies all app requests to a unix {app-name} unix socket. At the same time a Procfile will be created with a web config on the same socket.

Run sudo nginx -s reload to load the new config.

Next, one starts the app with foreman start -f Procfile.local and point the browser to http://app.dev.

Author

Socket-idea by Bob Van Landuyt - @Reprazent

Koen Van der Auwera - @atog

You can’t perform that action at this time.