Synology SSL 和 nodejs

Synology SSL & nodejs

我有一台 synology NAS,其中安装了 let's encrypt 证书。我可以从外部浏览到 https://mynas.dyndns.info,然后我将收到一个安全页面。所以这我工作正常!

现在我正尝试 运行 端口 3000 上的 nodejs 服务器。我怎样才能确保此连接安全?我不知道从哪里开始。有任何提示教程、示例吗?

提前致谢,

彼得

在这种情况下,您或许可以制作一个反向代理。

对于 nginx 我将此基本配置用于我的节点应用程序:

server {

    listen       80;
    server_name  localhost;

    location /actions {
        rewrite ^/actions$ / break;
        rewrite ^/actions/(.*) / break;
        proxy_pass http://127.0.0.1:5000;
    }
    location / {
        proxy_pass http://127.0.0.1:8081;
    }
}

对于 apache 作为网络服务器我

  1. Create a folder in www or public_html, let's say node
  2. Inside node I make a .htaccess file and
  3. add the following lines,

    RewriteEngine On
    RewriteRule ^$ http://127.0.0.1:8080/ [P,L] #which is your node server ip:port
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ http://127.0.0.1:8080/ [P,L] #same ip:port