一、Windows系统上安装nginx
下载:
http://nginx.org/en/download.html
二、Mac系统上安装nginx
1 使用brew安装nginx
brew install nginx
如果homebrew不是最新版本,会先更新,
Updating Homebrew...
当然可以设置不自动更新(网上搜吧。。)
2 安装完成之后,执行如下命令启动:
sudo nginx
若出现,
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
有其它进程占用8080端口,可以打开/usr/local/etc/nginx/nginx.conf文件修改默认端口。
3 测试
访问http://localhost:8080,将显示nginx的欢迎页面。