Nginx is a web server that can be installed locally to help run websites on your computer. To install Nginx on a Mac, it is recommended that you install it using
If you haven’t already installed Homebrew, you can run the following command.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Continue on by installing Nginx using the
brew install command.
brew install nginx
To start the Nginx web server, run the
nginx command. You may have to run the command as administrator.
$ sudo nginx
By default, the Nginx configuration file,
nginx.conf is located within the following directory.
You should be able to see that Nginx is set to use port 8080, so head to
localhost:8080 in your browser to check if Nginx has been installed and configured correctly.
If it has, you should see the welcome page appear.
Stopping Nginx can be achieved using the following command.
$ sudo nginx -s stop