Switchless TEST


Nginx

Notes related to Nginx

Common debug

Check if Nginx config is error free

sudo nginx -t

When it has errors

nginx: [emerg] unknown directive "server\_name" in /usr/local/etc/nginx/servers/my.config:3

nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed

When it is all ok

nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

brew service does start nginx properly

When you try to run nginx using brew it does not work

brew services start nginx

But when you try to start nginx using brew in sudo mode, it works

brew services start nginx

Solution

sudo chown -R alex /usr/local/var/log/nginx/