There are following steps to install the Nginx on Mac OS:
Step 1: Download Homebrew
To install nginx/Windows, download the latest mainline version distribution (1.19.4), since the mainline branch of nginx contains all known fixes. Then unpack the distribution, go to the nginx-1.19.4 directory, and run nginx. Here is an example for the drive C: root directory: cd c: unzip nginx-1.19.4.zip cd nginx-1.19.4 start nginx. Homebrew When it comes to developing locally, there are many options for Mac users, including the dummy way of MAMP and XAMPP. However, for those who wants a NMP (Nginx. Select the latest zip file and download it to a new folder. As a first step, you need to extract the new folder. You can use 7-zip, WinRAR or any other popular compression software. After extracting the file contents in the original folder, you have to move the entire folder that came with the built-in download.
To install the Nginx on Mac OS, Homebrew must be installed on the system. Homebrew is a package manager for Mac operating system that allows us to install various Unix applications easily. If you don't have Homebrew, use the following link to install: https://brew.sh/
Or simply type the following command on the terminal:
Step 2: Update the Homebrew repository index
Update the repository index of the Homebrew package installer. This can be done through the brew update command.
Step 3: Install Nginx
The homebrew package installer will help to install the Nginx web server on the macOS. To install the Nginx, use the following command:
The Nginx server will install on the location /usr/local/cellar. The entire executable services related to starting and stopping Nginx are stored inside the bin folder of the installation directory.
The web server will listen by default on port number 8080. To start the Nginx, use the following command:
And to check whether the nginx is correctly installed on the computer, type the localhost on the browser or run the following command on the console:
To stop the Nginx services, use the following command:
![Nginx Mac Download Nginx Mac Download](/uploads/1/2/8/4/128440513/925693765.png)
Important locations:
- Add configs in -> /usr/local/etc/nginx/servers/
- Default config -> /usr/local/etc/nginx/nginx.conf
- Logs will be in -> /usr/local/var/log/nginx/
- Default webroot is -> /usr/local/var/www/
- Default listen address -> http://localhost:8080