配置文件
server {
listen 80;
server_name localhost:80;
root /usr/html;
index index.html;
location /favicon.ico {
log_not_found off;
}
location /aria2/ {
proxy_pass http://localhost:6800/;
}
location /dl {
root /aria2;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
expires 30d;
}
}
运行在docker容器里面,对外端口33333,现在问题是访问http://127.0.0.1:33333/dl ,会自动301跳转到80端口:http://127.0.0.1/dl/ ,按搜到的方法都无法解决
还有如果配置成
location /aria2 {
proxy_pass http://localhost:6800/;
}
就会404
192.168.6.122 - - [15/Mar/2018:05:15:48 +0000] "POST /aria2/jsonrpc HTTP/1.1" 404 0 "http://192.168.6.235:33333/" "Mozilla/5.0 (Windows NT 6.1; rv:51.0) Gecko/20100101 Firefox/51.0" "-"
请问要如何解决?
建议你看下 nginx 的错误日志,
进入nginx 的bash 或 sh ,命令为 docker exec -it [容器名] bash
然后到 /var/log/nginx/error.log 查看