Skip to content

Instantly share code, notes, and snippets.

@dotspencer
Last active April 2, 2022 04:03
Show Gist options
  • Save dotspencer/752e207664601b5c0a75432f53c95f71 to your computer and use it in GitHub Desktop.
Save dotspencer/752e207664601b5c0a75432f53c95f71 to your computer and use it in GitHub Desktop.
NGINX setup on Mac

Install NGINX:

brew install nginx

Start NGINX (as background service):

brew services start nginx
sudo nginx # to start for first time

Move to macOS config location and create symlink so it can be accessed like Ubuntu with cd /etc/nginx

cd /usr/local/etc/nginx
sudo ln -s ../../usr/local/etc/nginx/ .

.... (what actually worked ↓)

cd /etc
sudo ln -s /opt/homebrew/etc/nginx .

Create sites-available and sites-enabled directories:

mkdir sites-available sites-enabled

Connect sites-enabled by adding the following line inside the http block in /usr/local/etc/nginx/nginx.conf

include sites-enabled/*;

Test configuration and restart with:

# Test
sudo nginx -t

# Reload
sudo nginx -s reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment