Install with brew
Use brew to install the nginx with command:
1
| |
After install run:
1
| |
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:
1
| |
Then open nginx.conf with:
1
| |
and change the:
1 2 3 4 5 6 7 8 9 10 | |
to:
1 2 3 4 5 6 7 8 9 10 | |
Save configuration and start nginx by
1
| |
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:
1 2 3 4 5 6 7 8 9 10 | |
To let say Users/xajler/www:
1 2 3 4 5 6 7 8 9 10 | |
After change stop and start nginix server and nginx is now serving pages from your custom folder!