Skip to content

nginx

字数: 0 字 时长: 0 分钟

https://nginx.org/en/download.html

sh
# 启动
start nginx

# 重启
nginx -s reload

配置 nginx.conf

conf

worker_processes 1;

events {
    worker_connections 1024;
}

http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    server {
        listen 8101; #1.你想让你的这个项目跑在哪个端口
        server_name localhost; #2.当前服务器ip
        location / {
            root html/web/; #3.dist文件的位置(根据自己dist包放置的位置决定)
            try_files $uri $uri/ /index.html; #4.重定向,内部文件的指向(照写,history和bash通用,这里配置主要是兼容history模式,进行一 个404的重定向)
        }
    }
}