How to install and control nginx service on MacOS

Install nginx

brew install nginx

Update nginx conf

nano /usr/local/etc/nginx/nginx.conf

Service control commands

// Start nginx
nginx 

// Test nginx conf
nginx -t

// Expected test result output
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



// Reload nginx
nginx -s reload

// Stop nginx
nginx -s stop

Leave a Reply

Close Menu