关于nginx:nginx

10次阅读

共计 801 个字符,预计需要花费 3 分钟才能阅读完成。

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

成果

正文完
 0