4
4
4utka_pyan2017-11-24 05:14:43
Nginx
4utka_pyan, 2017-11-24 05:14:43

How to output go response through nginx?

Given:
Golang is installed on the system, the command usr/local/go/bin/helloreturns Hello world!
Nginx opens the standard stub Welcome to nginx!
Open etc/nginx/sites-enabled/default
Change root /var/www/html;to root /usr/local/go/bin/hello;
Answer Welcome to nginx! disappears, now instead of it 404 Not Found.
The directory cd usr/local/go/bin/hello doesn't exist. hello is a file in the go/bin directory

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pavlyuk, 2017-11-24
@4utka_pyan

You are cooking it completely wrong. You are trying to do it in CGI style.
You need to raise the http server in the go, using the net / http package or some framework of your choice and redirect requests from Nginx to it via proxy-pass.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question