Mac Nginx 报错 403 - 前端杂记(2)

207 阅读1分钟

Mac Nginx 今天突然报错 403,看日志是 Permission denied

2024/08/03 12:29:30 [crit] 13316#0: *1 stat() 
"/Users/mac/Downloads/hhh/documentation/harsinemessage" failed (13: Permission denied), client: 127.0.0.1, server: localhost, request: "GET /documentation/harsinemessage HTTP/1.1", host: "localhost:8080"

查看用户

打印进行用户是 nobody

ps aux | grep "nginx: worker process" | awk  '{print $1}'
nobody
mac

修改配置里面的用户

写死他,不知道为什么

user root admin;

Vue History 模式 dist 的Nginx配置

location / {
    root /Users/mac/Downloads/dist;  # 将此路径替换为Vue项目dist文件夹的路径
    try_files $uri $uri/ /index.html;
}