NGINX反向代理背后的YOURLS

时间:2020-04-23 09:23:48

标签: nginx docker-compose reverse-proxy nginx-reverse-proxy yourls

我在VPS上安装了YOURLS Docker和其他“ Dockerize”服务。我所有的服务都在NGINX反向代理后面。为简单起见,我想创建一个带有网页的 web-srv (端口3000上的Nodejs)和我的 yourls-srv (端口80)。

一切正常。我可以访问我的网页,如果我转到YOURLS管理页面,则可以正常运行。问题是我的短网址无效。我认为问题在于反向代理配置。

nginx.conf


events { worker_connections 1024; }

http {
  types {
    text/html html;
    text/css css;
  }

  sendfile on;

  upstream websrv {
    server websrv:3000;
  }
  upstream yourls {
    server yourls:80;
  }

  server {
    listen 80;

    location / {
      proxy_pass  http://websrv;
    }

    location ^~ /admin/ {
      proxy_pass http://yourls$request_uri;
    }

    location ~* ^/[a-z0-9]$ {
      proxy_pass http://yourls$request_uri;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_intercept_errors on;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
      deny all;
    }
  }
}```

If anyone has solved this issue, or can help me with NGINX reverse proxy config...thank you.

0 个答案:

没有答案