Homebrew Nginx not running but says it is in brew services Homebrew Nginx not running but says it is in brew services nginx nginx

Homebrew Nginx not running but says it is in brew services


nginx is failing to launch because of an error, but brew-services is not communicating that to you.

Running it with sudo, as other users have suggested, is just masking the problem. If you just run nginx directly, you may see that there is actually a configuration or permissions issue that is causing nginx to abort. In my case, it was because it couldn't write to the error log:

nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)2020/04/02 13:11:53 [warn] 19989#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/etc/nginx/nginx.conf:22020/04/02 13:11:53 [emerg] 19989#0: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)

The last error is causing nginx to fail to launch. You can make yourself the owner of the logs with:

sudo chown -R $(whoami) /usr/local/var/log/nginx/

This should cause subsequent config errors to be written to the error log, even if homebrew services is not reporting them in stderr/stdout for now.

I've opened an issue about this: https://github.com/Homebrew/homebrew-services/issues/215

The log path may not the same for everyone. You can check the path to log file by checking the config file /usr/local/etc/nginx/nginx.conf. You can find a line like:error_log /Users/myusername/somepath/nginx.log;. Change the chown command above accordingly. If even this didn't solve the problem, you may have to do the same for any other log files specified in the server blocks in your nginx configuration


Try launching it with "sudo", even if the formula say

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo.

sudo brew services Nginx-Full start


this worked for me:

sudo brew services start nginx