1. Install nginx (need to install the Homebrew ). Use the command
brew install nginx
Install nginx.
2. Use the command
open /usr/local/Cellar/nginx
Interview with up to open the installation path.
3. Open the bin folder, double-click the file nginx, nginx start, then visit HTTP: // localhost: 8080 / .
Appears in Figure interface, then start nginx success.
4. Open the configuration file. Use the command
open /usr/local/etc/nginx
Open the path configuration file, and then nginx.conf text editor to open the file for editing.
5. Modify the deployment path path for the project, such as project Home path /Users/luoyihao/test/index.html,
Put
location / {
root html;
index index.html index.htm;
}
change into
location / { root /Users/luoyihao; index index.html index.htm; }
6. Restart nginx, use the command
nginx -s reload
And then visit http: // localhost: 8080 / test / index.html can be.