Create A New nginx Server On A Mac

February - 2021

TODO: Fix the formatting of this post that got busted during the move to nextjs


Setting up an nginx server

Create a config file under:

    /usr/local/etc/nginx/servers


Make it look something like this:

    server {
        listen       80;
        server_name  legendary.react_scratchpad;

        #access_log  logs/host.access.log  main;

        location / {
            root   /Users/alans/dev/react_scratchpad;
            index  index.html;
        }

        error_page  404              /404.html;
        error_page   500 502 503 504  /50x.html;
    }
    


Then start and stop nginx with:

    sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
    sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist