Brew Nginx

  1. Mac Nginx Config
  2. Macos Nginx

My Front End Deployment on Fresh install MacBook Yosemite. Installations XCode Brew Gettext NPM NGINX php redis mariadb Go brew install go -with-cc-common ForkLift Browsers Chrome Firefox SublimeText 3 HTML5 Emmet Alignment Bracket Highlighter Syncthing (Dropbox Replacement) Tower 2 Sequel Pro Node -g express-generator gulp grunt-cli bower browserify livereload XChat Azure (IRC). Linuxbrew nginx Addeddate 2021-04-08 00:19:24 Identifier linuxbrew-nginx Scanner Internet Archive Python library 1.9.4. Plus-circle Add Review. Reviews There are no reviews yet. Be the first one to write a review. DOWNLOAD OPTIONS download 41 files.

Getting Started

Install with brew

After install run: Go generate protobuf.


Open Navigator it by going to URL:


The default place of nginx.conf on Mac after installing with brew is:


Changing the default port (8080)

We shall change it to 80. First stop the nginx server if it is running by:

Update thanks @zue666, @pixel67 if apache is running must also stop sudo apachectl stop

Then open nginx.conf with (example subl):

and change the:


Save configuration and relaunch nginx


Open Navigator it by going to URL:


Update: thanks @pablohenrique * ERROR 403 Forbidden - * dont worry, some other application is already using port 80. probably be skype.

Solution 1: Change Skype port in Skype > Preferences > advanced 2 Solution Solution 2: No change server { listen to 80.

That means that nginx will use port 8080 instead of 80. To access it I would use this url http://localhost:8080.

Changing the path of defualt web location

The nginx html folder (brew install only) is by the defult in: /usr/local/Cellar/nginx/1.2.3/html

Note: change ** 1.2.3 ** to your nginx version.

The defualt path configuration:

To let say Users/to/www:

After change relaunch nginix server and nginx is now serving pages from your custom folder!


It is a good idea to have your development environment be as close to your production environment as possible, without getting in your way. For example setting up SSL in your development environment helps you to fix mixed content warnings so there are no surprises when you move to staging or production, and doesn't train you to click through SSL warnings in your browser.

Brew Nginx

This walkthrough will show you how to create, trust, and install a self signed certificate in your development web server, and setup your DNS to redirect all your development traffic back to your development box.

Prepare the System

Assumptions: you are using the Bash shell, have admin rights to your computer, and are using Firefox, Chrome, or Safari. Ensure that OpenSSL, Passenger, Dnsmasq, and optionally Nginx or Apache are installed.

Follow these instructions to install Passenger; you may have to adjust the settings to your desired config, for example using Passenger Enterprise or OSS.

Debian, Ubuntu
Red Hat, CentOS, Fedora, Amazon Linux, Scientific Linux

Software versions used in this article:

To check the versions of the packages you have installed you can use the following commands:

Application Version Linux Command Mac Command
OpenSSL 1.0.2h
Passenger 5.0.29
Nginx 1.10.1
Dnsmasq 2.76
Firefox 47.0.1
Chrome 51.0.2704.*
Safari 9.1.1

OpenSSL Configuration

When setting up a development environment with SSL it is better practice to use a self signed certificate, and leave your real certificate/key pair somewhere safe and encrypted, preferably on offline storage like a thumb drive in a safe place. In order to create a certificate that works and makes development convenient, you need to edit the openssl.cnf file.

On macOS this is located at /usr/local/etc/openssl/openssl.cnf or if it isn't there you can copy /usr/local/etc/openssl/openssl.cnf.default to that path as a starting point, and edit from there.

On linux it may be in one of the following locations: /usr/local/ssl/openssl.cnf/usr/lib/ssl/openssl.cnf/etc/ssl/openssl.cnf/etc/pki/tls/openssl.cnf

The changes you need to make are as follows:

uncomment these lines, they enable needed functionality:

comment out these lines, they add nothing and get in the way:

and modify the following values as indicated:

modify the following values as desired:

specify all your development domains

add the following on a new line under keyUsage = nonRepudiation, digitalSignature, keyEncipherment:

Using a separate top level domain (TLD) for development allows you to access the production site at the proper url, while having easy access to your development sites. This guide will use .dev and will go into more detail about how to set this up below in the DNS section.

While no browser accepts wildcard certificates for entire top level domains, if you are developing a large number of micro services or sites that share a domain and have added a wildcard for the domain to the list of alt names in the certificate, then you can simply add more sites to your setup without changing your certificate and by using mass deployment you don't have to modify your web server or app server configs to spin up another site, simply create it in the correct directory.


A working sample is provided below

Replace occurrences of with your own domain:

Mac Nginx Config

Add to your path:

Debian, Ubuntu
Red Hat, CentOS, Fedora, Amazon Linux, Scientific Linux

Macos Nginx

Create Your Certificate Authority

The changes you made to openssl.cnf will allow the certificates produced with your CA to be accepted by modern browsers. You can hold enter/return to accept the default values for each question you get asked by the script, with the exception of the passphrase which must be at least 4 characters long.

Trust your new certificate authority root certificate:

The previous command will have created a new subdirectory called demoCA, you’ll need to install the certificate authority root certificate from the new demoCA dir into your system keychain (and/or Firefox) to prevent your browser from warning you about broken SSL.

macOS with Safari or Chrome:
Debian, Ubuntu with Chrome:
Fedora 19+, RHEL/CentOS 7+ Chrome:
Any OS with Firefox:
Any *nix OS with Curl: Pass the --cacert flag to curl when you use it to query your website.

create the new server certificate/key pair:

You can accept all the defaults, as you already customized them earlier.

Configure Passenger + Nginx

Replace with your domain, and set the paths to your app and the certificate/key pair you created:

Generate the Diffie-Hellman parameters file using this command:

Configure DNS

Since you need the domain you visit in your browser to match the SSL certificate, you still need to direct all your development traffic back to localhost. One option is to edit your hosts file (located at /etc/hosts) and add entries to redirect each development domain back to your computer. That solution works*, but doesn't scale well. Next I'll describe setting up Dnsmasq & configuring your own top level domain in order to save having to edit the hosts file repeatedly.

*Note some older versions of macOS actually ignored entries in the hosts file for new top level domains (for example: .dev stopped working once Google started responding to DNS queries for that top level domain. Google owns .dev, but they've stated it's for internal use only, so you're unlikely to break anything if you use it, unless you work for Google), which makes using a DNS resolver like Dnsmasq all the more useful, because you workaround that bug.

In Ubuntu 12.10+ use NetworkManager's Dnsmasq:
Other Linux:


Now if you restart your webserver, SSL should be working and your browser shouldn't complain when you visit your app over https.