nginx shellinabox结合

nginx 配置

root@ranchers1:/etc/nginx/sites-enabled# cat alex
server {
listen 801;
listen [::]:801;

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

server_name www.alexman.cn;


location /shell/ {
proxy_pass http://192.168.219.201:4200/;
}

}

shellinabox配置:

vim /etc/default/shellinabox

# Should shellinaboxd start automatically
SHELLINABOX_DAEMON_START=1

# TCP port that shellinboxd's webserver listens on
SHELLINABOX_PORT=4200

SHELLINABOX_ARGS="--no-beep -t"                                         # -t 不用https

SHELLINABOX_ARGS="--no-beep -t --service=/shell:LOGIN"     # 监听特殊url  /shell

SHELLINABOX_ARGS="--no-beep -t  --service=/uaidjango:SSH"      #监听特殊url  并用ssh来登录

k8s中ingress注释:

nginx.org/rewrites

serviceName=alexd rewrite=/

ingress例子:https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations/

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cafe-ingress-with-annotations
  annotations:
    nginx.org/proxy-connect-timeout: "30s"
    nginx.org/proxy-read-timeout: "20s"
    nginx.org/client-max-body-size: "4m"
    nginx.org/server-snippets: |
      location / {
        return 302 /coffee;
      }
spec:
  rules:
  - host: cafe.example.com
    http:
      paths:
      - path: /tea
        backend:
          serviceName: tea-svc
          servicePort: 80
      - path: /coffee
        backend:
          serviceName: coffee-svc
          servicePort: 80


原文地址:https://www.cnblogs.com/alexhjl/p/11942162.html