How to Install Nginx on MacOS
Andrey Byhalenko
I am a self-driven DevOps expert with 15 years of experience in the IT industry. I write articles aimed at Junior DevOps engineers and those aspiring to become DevOps engineers.
First, you need to install Homebrew. Homebrew is a package manager for Max OS. It’s allowing us to install Unix applications easily. More information is available here: https://brew.sh/.
Run the following command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After the installation, update the Homebrew repository:
brew update
Now install Nginx:
brew install nginx
The Nginx server will be installed at the location /usr/local/cellar. The entire set of 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 8080. To start Nginx, use the following command (bear in mind the correct version folder):
launchctl load /usr/local/cellar/nginx/1.22.1/homebrew.mxcl.nginx.plist
To check whether Nginx is correctly installed on the computer, type the localhost address in the browser (127.0.0.1) or run the following command on the command line:
curl https://127.0.0.1:8080
To stop the Nginx services, use the following command:
launchctl unload /usr/local/cellar/nginx/1.22.1/homebrew.mxcl.nginx.plist
The default location of the Nginx configuration file is /usr/local/etc/nginx/nginx.conf.
Learn more about the Nginx configurations here — Nginx functionality.
AI / ML Engineer | Pursuing AIDS
6 个月thnx