Answer the question
In order to leave comments, you need to log in
How to set up ngnix+go?
Hello, I need to deploy an application in golang.
Decided to use ngnix.
Here is the nginx.conf config added to line 43:
server {
listen 80;
server_name MyDomain.ru;
location / {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}
func main() {
l, err := net.Listen("tcp", "127.0.0.1:9000")
if err != nil {
return
}
http.HandleFunc("/", handler)
fcgi.Serve(l, nil)
}
Answer the question
In order to leave comments, you need to log in
Просто делайте приложение как обычный http-сервер. Через http.ListenAndServe, например. В nginx делаете так:
server {
listen 80;
server_name MyDomain.ru;
location / {
proxy_pass http://127.0.0.1:9000;
proxy_set_header X-Real-IP $remote_addr;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question