gpt4 book ai didi

go - nginx proxy_pass on/giving 404 与 go 应用程序

转载 作者:行者123 更新时间:2023-12-03 02:23:27 26 4
gpt4 key购买 nike

我有一个简单的 go 应用程序,它通过 nginx proxy_pass 提供 html。我的问题是/上出现 404,其他指令工作正常。有什么想法吗?

nginx 配置文件

server {
listen 80 default_server;
listen [::]:80 default_server;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8001;
}

location /codcall {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8001;
}
location /codcall-dev {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8001;
}
}

我的 Go 应用路线

func main() {
http.HandleFunc("/", indexHandler)
http.HandleFunc("/codcall", indexHandler)
http.HandleFunc("/codcall-dev", indexHandler)
http.ListenAndServe(":8001", nil)

}

最佳答案

肯定是加载的配置和我认为加载的配置之间的某个地方混淆了。我重新启动了我的 vps,并仔细检查了所有配置及其现在的工作情况。

关于go - nginx proxy_pass on/giving 404 与 go 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58583161/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com