AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-577851

campos's questions

Martin Hope
campos
Asked: 2021-03-26 06:42:40 +0800 CST

如何不将服务器名称重定向到应用程序?

  • 0

在域文件“db.myplace.mydomain.com”中,我为反向代理配置了一个名称(proxy.myplace.mydomain.com)和一个 Web 应用程序的名称(myapp.myplace.mydomain.com)。但是,当我在浏览器中键入代理的名称时,myapp 的名称会返回给我。我不希望代理名称在浏览器中返回任何内容。我该如何配置?

db.myplace.mydomain.com 文件中的设置:

proxy                   IN  A       192.168.0.20
myapp                   IN  CNAME   proxy

sites-available/myapp.conf 文件中的设置:

server {
    listen              443 ssl http2;
    listen              [::]:443 ssl http2;
    server_name         myapp.myplace.mydomain.com;

    # SSL
    ssl_certificate     /etc/nginx/ssl/certificate.crt;
    ssl_certificate_key /etc/nginx/ssl/certificate.key;

    # security
    include             nginxconfig.io/security.conf;

    # reverse proxy
    location / {
        proxy_pass http://192.168.1.250:8080;
        include    nginxconfig.io/proxy.conf;
    }

    # additional config
    include nginxconfig.io/general.conf;
}

# HTTP redirect
server {
    listen      80;
    listen      [::]:80;
    server_name myapp.myplace.mydomain.com;
    return      301 https://myapp.myplace.mydomain.com$request_uri;
}
bind nginx reverse-proxy
  • 1 个回答
  • 42 Views
Martin Hope
campos
Asked: 2021-03-04 12:35:17 +0800 CST

如何在 debian 实例中正确创建新用户?

  • 0

我正在使用 qcow2 格式的现成 debian 映像。默认用户是“debian”。我想通过 openstack-horizo​​n 创建另一个用户。所以我详细说明了以下脚本:

#cloud-config
users:
  - name: jumper
    ssh-authorized-keys:
      - ssh-rsa myKeyhere
    sudo: ["ALL=(ALL) NOPASSWD:ALL"]
    groups: sudo
    shell: /bin/bash

默认情况下,会执行 /etc/cloud/cloud.cfg 文件中的设置来创建实例。当我通过脚本创建新用户时,不会创建 debian 用户。这是正确的吗?当我创建一个新用户时,所有 cloud.cfg 设置都被忽略了吗?

openstack cloud-init openstack-horizon
  • 1 个回答
  • 200 Views
Martin Hope
campos
Asked: 2021-02-18 18:09:41 +0800 CST

负载平衡的反向代理的最佳设置是什么?

  • 0

我正在使用反向代理和负载平衡。在我的场景中,我有三台服务器。第一台服务器是代理。第二个和第三个是使用 swarm 的 docker 服务器。端口 2020 用于 Apache 服务的两个副本。2021 端口用于 Nginx 服务的两个副本。平衡是根据副本完成的。由于我是 Nginx 的新手,我想知道以下设置是否足够。是否有可能改进此配置?安全吗?

proxy_config.conf:

##########
# Apache #
##########

  upstream apache {
        least_conn;

        #Container replicas
        server 192.168.0.4:2020;
        server 192.168.0.5:2020;
  }
  server {
        listen 80;
        server_name host.apache.domain.com;

        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://apache;
        }
   }

#########
# Nginx #
#########

  upstream nginx {
        least_conn;

        #Container replicas
        server 192.168.0.4:2021;
        server 192.168.0.5:2021;
  }

  server {
        listen 80;
        server_name host.nginx.domain.com;

        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://nginx;
        }
   }

在这种特定情况下,我使用了以下内容:

    location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://nginx;
    }

如果我只使用下面的配置,难道还不够吗?

    location / {
            proxy_pass http://nginx;
    }

我阅读了 Nginx 文档,但我需要更多示例。

load-balancing nginx reverse-proxy
  • 1 个回答
  • 362 Views
Martin Hope
campos
Asked: 2020-06-05 06:09:19 +0800 CST

如何通过ip或域名将http访问重定向到https域名?

  • 0

配置好我的Web服务器后,通过IP或域名访问时,https重定向如下:

http://192.168.10.5 to https://192.168.10.5

http://www.example.com to https://www.example.com

但是,我希望将http://192.168.10.5和http://www.example.com重定向到https://www.example.com。

基本 Nginx 配置:

server {
    listen       80 default_server;
    server_name  192.168.10.5 www.example.com;

    location / {
            rewrite     ^(.*)   https://$http_host$1 permanent;
    }
}

server {

    listen      443 http2 ssl;
    server_name www.example.com;

     root /var/www/example/html;

    ssl_certificate /etc/ssl/certs/mycert.crt;
    ssl_certificate_key /etc/ssl/private/mykey.key;

   } 

nginx
  • 1 个回答
  • 51 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve