Install with brew
Use brew
to install the nginx
with command:
After install run:
Testing
Test it by going to URL:
http://localhost:8080
Configuration
The default place of nginx.conf
on Mac after installing with brew
is:
/usr/local/etc/nginx/nginx.conf
Changing the default port
The nginx default port is 8080, we shall change it to 80. First stop the nginx server if it is running by:
Then open nginx.conf
with:
and change the:
/usr/local/etc/nginx/nginx.confto:
/usr/local/etc/nginx/nginx.confSave configuration and start nginx by
Changing the path of defualt web location
The nginx html folder (brew install only) is by the defult in:
/usr/local/Cellar/nginx/1.2.3/html
Note: change 1.2.3
to your nginx version.
The defualt path configuration:
/usr/local/etc/nginx/nginx.conf To let say Users/xajler/www
:
After change stop and start nginix server and nginx is now serving pages from your custom folder!