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;        }    }}

成果