server {
access_log /var/log/nginx/income-proxy-access.log;
error_log /var/log/nginx/income-proxy-error.log;
listen 443 ssl;
listen 80;
server_name <внешний ip proxy сервера>;
charset utf-8;
client_max_body_size 10m;
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_certificate /etc/nginx/ssl/income-proxy.pem;
ssl_certificate_key /etc/nginx/ssl/income-proxy.key;
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://<внешний ip локального сервера>;
}
}
2018/06/19 06:32:53 [error] 30496#0: *115159 connect() failed (113: No route to host) while connecting to upstream, client: <локальный ip>, server: , request: "GET /api/test HTTP/1.1", upstream: "http://ip_локального_сервера:80/api/test", host: "ip_proxy"
ssh root@server.ru -R6666:localhost:3000
server {
listen 443 ssl;
server_name server.ru;
location / {
proxy_pass http://localhost:6666;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
}
# https://stackoverflow.com/a/15198031
% ssh -M -S expose.socket -fnNT -R 6666:localhost:3000 root@server.ru
% ssh -S expose.socket -O check root@server.ru
Master running (pid=71660)
% ssh -S expose.socket -O exit root@server.ru