小编Das*_*ash的帖子

Nginx 反向代理需要在 htpasswd 结束时使用 }

在线生成 htpasswd 文件后,nginx 给我错误“nginx: [emerg] 意外的文件结尾,在 /etc/nginx/sites-enabled/htpasswd:2 中需要“;”或“}”。奇怪的是,只有一行。我的配置文件如下:

server {
    listen 80;

    index index.html
    auth_basic "User: (username) Password: (password)";
    auth_basic_user_file htpasswd;
    location / {
         proxy_pass http://localhost:8080;
    }
}
Run Code Online (Sandbox Code Playgroud)

我很好奇这是为什么。谢谢。

编辑:我的htpasswd内容如下:xxx:$apr1$xxx

proxy nginx

2
推荐指数
1
解决办法
607
查看次数

标签 统计

nginx ×1

proxy ×1