windows nginx 简单配置
- 下载
- windows 版本的 nginx 下载地址
- nginx-1.19.0.zip
- 安装
- 解压
nginx-1.19.0.zip - 拷贝至自己指定的目录(D/nginx-1.19.0)
- 解压
- 启动nginx
- 双击 目录下
nginx.execmd会闪一下 - 命令启动也行 ` start nginx`
- 检查是否启动成功
http://localhost:80出现 Welcome to nginx! 页面就代表成功了
- 双击 目录下
- 单页面应用路由配置
location / {
root html;
index /index.html;
try_files $uri $uri/ /index.html;
}
-
开启gzip
location / { root html; index /index.html; try_files $uri $uri/ /index.html; gzip_static on; }
nginx 常用命令
- 启动 ` start nginx`
- 关闭
nginx -s stop - 重启
nginx -s reopen - 重新载入配置文件
nginx -s reload