Nginx For Mac Os

Posted onby admin

I'm using Mac OS and nginx version: nginx/1.17.7. The first time I downloaded Nginx was some time ago. At that time, everything ran perfectly. Then When I played around with nginx.conf, I messed it up somehow. So, when I restarted learning Nginx today, I removed all the files I had before and reinstalled it through homebrew. How to Install Nginx on MacOS Introduction. Nginx is a web server which can also be used as a HTTP cache, load balancer and reverse proxy.This was first created by Igor Sysoev and released in 2004 under the terms of BSD like license. Dec 04, 2017 My MacBook Pro installed Mac OS High Sierra and it was shipped with pre-installed PHP package. So, depending on your web development environment setup, you may need to upgrade default PHP version to the latest version. Normally, Mac OS X doesn’t ship with its own copy of MySQL. So, you will have to install MySQL on your local machine. I have successfully installed nginx on my MAC with homebrew. Brew install nginx but i can't find from where is this default page called. In nginx.conf under location says. Root html; and i can't find it.

  1. Mac Nginx Install
  2. Mac Os Catalina
  3. Nginx Mac Download

Install with brew

Use brew to install the nginx with command:

After install run:

Testing

Open Navigator it by going to URL:

Configuration

The default place of nginx.conf on Mac after installing with brew is:

Changing the default port (8080)

We shall change it to 80. First stop the nginx server if it is running by:

Update thanks @zue666, @pixel67
if apache is running must also stop
sudo apachectl stop

Then open nginx.conf with (example vim):

and change the:

to:

Save configuration and relaunch nginx

Testing

Open Navigator it by going to URL:

Update: thanks @pablohenrique
* ERROR 403 Forbidden - *
dont worry, some other application is already using port 80. probably be skype.

Versions

1 Solution 1: Change Skype port in Skype > Preferences > advanced
2 Solution 2: No change server { listen to 80.

That means that nginx will use port 8080 instead of 80. To access it I would use this url
http://localhost:8080.

Changing the path of defualt web location

he nginx html folder (brew install only) is by the defult in:

Note: change ** 1.2.3 ** to your nginx version.

The defualt path configuration:

Mac Nginx Install

To let say Users/to/www:

Mac Os Catalina

Install

Nginx Mac Download

After change relaunch nginix server and nginx is now serving pages from your custom folder!

enjoy!