window
命令
start nginx // 开机启动,不要使用 ./nginx会丢失光标
./nginx -s reload //重启
./nginx -s stop 停止
./nginx -t 配置是否正确
前端部署
单文件
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
index
</body>
</html>
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
location / {
root html;
index index.html index.htm;
}
}
}
效果


vueCli项目根路径
vue项目配置

nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
location / {
root html;
index index.html index.htm;
}
}
server {
# //不能写80
listen 81;
location / {
root html/app;
index index.html index.htm;
}
}
}

效果

vueCli项目子路径
vue项目配置

nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
location /my-app {
root html/dist;
index index.html index.htm;
}
}
}

效果

**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。