How to install and control nginx service on MacOS

Install nginx

  1. brew install nginx
brew install nginx

Update nginx conf

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

Service control commands

  1. // Start nginx
  2. nginx
  3. // Test nginx conf
  4. nginx -t
  5. // Expected test result output
  6. nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
  7. nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
  8. // Reload nginx
  9. nginx -s reload
  10. // Stop nginx
  11. nginx -s stop
// 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

  • Default Comments (0)
  • Facebook Comments

Close Menu
Close Menu
undefined