S
S
Stealth9112020-01-12 18:34:43
Nginx
Stealth911, 2020-01-12 18:34:43

How to forward nginx from subdomain to one specific port?

Good afternoon! I installed nginx, created a subdomain on reg.ru, specified the ip address of my server for this subdomain.
Further in server.conf I register:
server {
listen 80;
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.access.log main;
location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|woff|woff2|swf|ttf|svg|html|txt)$ {
root /var/www/example.com/public;
expires 1y;
}
location / {
proxy_pass 127.0.0.1:1194/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
}
I'm trying to restart the server and it says Failed to start A high performance web server and a reverse proxy server.
Can you tell me how to set up NGINX? so that from my subdomain, when making a request to the server, there was a redirect to a specific port.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2020-01-12
@ky0

What you set up is not forwarding, but proxying. And judging by the port - you want to do something with openvpn, this is not for nginx.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question