As Tor is not a http proxy but a Socks one you cannot insert .onion name or IP in proxy_pass
directive. In order to use Nginx as reverse proxy to .onion sites you will need a socat.
Socat is a command line based utility that establishes two bidirectional data streams and transfers between them. This data can take many forms such as files, pipes, devices (terminal or modems), or sockets (UNIX, IPv4, IPv6, TCP, SSL etc). The streams can be constructed from a large and diverse selection of data sinks, sources and address options, which allows Socat to be highly flexible in its usage. It is for this reason that it and similar tools are often referred to as multipurpose relays. Continue reading