#1374  SSH with Nginx in Docker Mode
Closed
Vasiliy Kulikov opened 12 months ago

I'am using next docker containers stack: Nginx, OneDev, MariadB, Adminer. And try to clone repo with SSH protocol, but this is not work for me. I get warning: "fatal: '/test_project' does not appear to be a git repository".

I found in similar issue (issue onedev/server#1136), Nginx is not forwarding request from 22 port of Host to 6611 port of 1dev. Then i added rule in server block of Nginx:

server {
    listen   22;
    server_name   onedev.example.com;
    include   nginxconfig.io/security.conf;
    
    location / {
        proxy_pass   http://1dev:6611/;
    }
}

And set next settings in OneDev instance:

Server URL: http://localhost:6610
SSH Root URL: ssh://localhost:6611 

But it still doesn't work. What am i doing wrong?

Robin Shen commented 12 months ago

Nginx ssh port forwarding can not be achieved via http based port forwarding. It should be done via stream proxying. For details, please check:

https://stackoverflow.com/questions/71789156/how-to-redirect-ssh-requests-in-nginx

Vasiliy Kulikov commented 12 months ago

Nginx ssh port forwarding can not be achieved via http based port forwarding. It should be done via stream proxying. For details, please check:

https://stackoverflow.com/questions/71789156/how-to-redirect-ssh-requests-in-nginx

Yep, you are right. I had to set up stream block and right ports on VPS and nginx, and after that all is fine. Thank you!

Vasiliy Kulikov changed state to 'Closed' 12 months ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (4)
Reference
onedev/server#1374
Please wait...
Page is in error, reload to recover