sudo brew services stop nginx
sudo brew services start nginx
Sudo because I have it bound to :80, which is otherwise not allowed.
Seems to work better than singular restart command (I think)
sudo brew services stop nginx
sudo brew services start nginx
Sudo because I have it bound to :80, which is otherwise not allowed.
Seems to work better than singular restart command (I think)
Feb 2020 – replacing Apache with Nginx to fix broken dev env.
Nginx with PHP-FPM was giving 404 because the script name wasn’t being forwarded to PHP-FPM.
Needed this inside the fast_cgi file. It wasn’t there by default, but some random Googling turned it up 🙁
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Nginx may start as non-sudo/root user and lack permission to bind to :80
In that case I brew services stop nginx, then sudo brew services start nginx.
When you move a website and change its DNS A record you will need to delete it from the old Nginx server. Otherwise when Nginx reboots (e.g. after a certificate renewal) it will fail DNS resolution.
I believe this can be changed, but by default Nginx will break when the DNS connection (even of an unrelated site) changes.