首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ubuntu操作系统上的安全端口8000

Ubuntu操作系统上的安全端口8000
EN

Server Fault用户
提问于 2020-04-15 13:09:22
回答 1查看 537关注 0票数 0

我刚刚学习了以下教程:

代码语言:javascript
复制
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

# Only valid for 90 days, test the renewal process with
certbot renew --dry-run

这确实有效,但只适用于在主域上运行的客户端。但是,我还有一个API运行在端口8000上。当我访问mydomain.com:8000时,它确实将我重定向到https,但它显示了以下错误:

基本上它永远都是装的。

我已经允许https进入防火墙了。我的意思是,基本域工作得很好,只是端口8000不适用于https,它确实适用于http..。

代码语言:javascript
复制
server {

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html/dexhub/client/build;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;
        server_name www.iprofitmizer.com iprofitmizer.com; # managed by Certbot

        error_page 404 /;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
        location /api {
          proxy_pass http://localhost:8000;
        }
EN

回答 1

Server Fault用户

回答已采纳

发布于 2020-04-15 15:32:15

获得nodejs的最简单方法是通过这样的代理来定义它

代码语言:javascript
复制
location /api {
    proxy_pass http://localhost:8000;
}

在您的nginx虚拟主机配置(例如/etc/nginx/sites-enabled/my-site.conf)中。然后,您应该能够访问您的API通过https://iprofitmizer.com/api和certbot自动更新也应该工作。

否则,您必须将TLS支持集成到nodejs应用程序中。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1012430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档