Installing “Nginx” on macOS using Homebrew and using “Nginx” as a Server Load Balancer

Abu Sayem Md Habibullah
2 min readJan 17, 2023

--

Thanks, @Mahmud Ridwan for making a good Nginx Working Flow Chart

We have to follow some commands to install “Nginx”

  1. Open Terminal — Cmd + Space

Write: Terminal

2. If you have done open successfully then now write

CMD: brew install nginx

3. To start the Nginx server just write

CMD: brew services restart nginx

4. Now Nginx is open and Nginx using port 8080, and to access the Nginx static site open the browser and write http://localhost:8080

5. To stop Nginx use the command

CMD: brew services restart nginx

6. To restart once again just write in the command line terminal

CMD: brew services restart nginx

7. To clean Nginx cash data just use in CLI

CMD: brew cleanup nginx

8. To use Nginx as a load balancers just need to setup “nginx.conf” file

Here is the file location: `/opt/homebrew/etc/nginx/nginx.conf`

You can have a look now at the doc for what type of balance you want

Nginx Docs https://nginx.org/en/docs`

9. To edit this file for a new feature I’m going to use the Nano editor

CMD: nano /opt/homebrew/etc/nginx/nginx.conf

10. Scroll down and have a look inside of the “HTTP” object we have one more “server” object also inside of the server one more object “location”

http{
server{
location / {
root html;
index index.html index.htm;
}
}
}

I will edit this section for my own types of load balancers

Enjoy…

Thanks, you guys @all

--

--

Abu Sayem Md Habibullah
Abu Sayem Md Habibullah

No responses yet