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-316474

uberrebu's questions

Martin Hope
uberrebu
Asked: 2022-11-09 20:19:59 +0800 CST

Nginx http 到 http redirect 400 纯 HTTP 请求被发送到 HTTPS 端口

  • 5

http://app1.internal.example.com:8080我有一个在端口上的 http 和端口上的 https 上公开的应用程序https://app1.internal.example.com:8443

所以我有 80 和 443 nginx 服务器块来帮助将来自 http 端口的请求重定向到应用程序的 https 端口

$ curl http://app1.internal.example.com:8080

<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
</body>
</html>

$ curl -IL http://app1.internal.example.com:8080

HTTP/1.1 400 Bad Request
Date: Wed, 09 Nov 2022 00:39:30 GMT
Content-Type: text/html
Content-Length: 220
Connection: close

这是返回 200 的 https 端口上的 curl

$ curl -IL https://app1.internal.example.com:8443

HTTP/1.1 200 OK
Date: Wed, 09 Nov 2022 00:38:00 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 1274335
Connection: keep-alive
Keep-Alive: timeout=20
Vary: Accept-Encoding

下面是我的 nginx 服务器块,用于 http 到 https 重定向

我该如何修复此错误,以便 curl 可以在 http 请求上返回 200

server {
    listen 80;
    listen [::]:80;

    server_name app1.internal.example.com;

    return 301 https://app1.internal.example.com:8443$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name app1.internal.example.com;

    location ^~ / {
        proxy_pass http://localhost:5000;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }
}
nginx
  • 1 个回答
  • 48 Views
Martin Hope
uberrebu
Asked: 2022-11-01 19:37:03 +0800 CST

nginx 使用 url 中的非标准端口重定向多个服务器名称

  • 5

我有一个类似的端点https://app1.company.com:5555,并且希望能够使用所有页面的 url 中的端口号浏览网站,并且也能够在没有端口号的情况下浏览,让我们说另一个 server_namehttps://dev-app1.company.com

所以例如https://app1.company.com:5555/tag/general,https://dev-app1.company.com/categories/ulmighty应该都有效

每当端口存在时,如何让 nginx 重定向并保留名称中的端口?

目前有这个

server {
    listen 80;
    server_name dev-app1.company.com app1.company.com;

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name dev-app1.company.com app1.company.com;

    location ^~ / {

        rewrite ^/(.*)$ /$1 break;
        proxy_pass http://localhost:9090;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }
}

但问题是它不使用端口号重定向,我希望它能够使用 url 中的端口号重定向,只要该服务正在该端口上运行并且它正在该5555端口上运行

更新:

应用程序已经在端口 5555 上侦听,我可以在此处访问https://app1.company.com:5555

当我有这个

server {
    listen 80;
    server_name app1.company.com;

    return 301 https://app1.company.com:5555$request_uri;
}

但现在我想添加更多服务器名称,这样我也可以访问其他没有端口的服务器名称

nginx
  • 1 个回答
  • 37 Views
Martin Hope
uberrebu
Asked: 2021-01-12 16:25:35 +0800 CST

如何通过不同的 DNS 服务器为私有和公共主机名的 DNS 设置 dnsmasq [重复]

  • 3
这个问题在这里已经有了答案:
将 dns 请求转发到另一个 dns 服务器 1 个回答
去年关闭。

假设我有这个私有主机名dev.private.example.com,它只能通过 VPN 连接在私有网络中访问,并且我有prod.example.com它可以访问互联网。我有 DNS 服务器来解析私有主机名,然后我可以使用公共 DNS 服务器(谷歌、cloudflare 等)作为公共主机名。

我会喜欢设置 dnsmasq(如果有其他工具,请告诉我),以便它会查询 DNS 服务器的私有主机名,如果它是另一个主机名,那么它将通过公共 DNS 服务器解析

我该怎么做呢?

internal-dns hostname linux-networking dnsmasq
  • 1 个回答
  • 749 Views
Martin Hope
uberrebu
Asked: 2017-10-05 16:39:14 +0800 CST

jq 无法索引错误

  • 0

我正在尝试使用 jq 从该端点获取某些信息

curl -s https://bittrex.com/api/v1.1/public/getmarketsummaries/ | jq '[.]'

和下面的输出

[
  {
    "success": true,
    "message": "",
    "result": [
      {
        "MarketName": "BTC-1ST",
        "High": 0.00010322,
        "Low": 9.32e-05,
        "Volume": 1475820.53114847,
        "Last": 9.414e-05,
        "BaseVolume": 145.89904728,
        "TimeStamp": "2017-10-05T00:32:45.283",
        "Bid": 9.415e-05,
        "Ask": 9.521e-05,
        "OpenBuyOrders": 614,
        "OpenSellOrders": 5887,
        "PrevDay": 0.00010169,
        "Created": "2017-06-06T01:22:35.727"
      },
      {
        "MarketName": "BTC-2GIVE",
        "High": 1.31e-06,
        "Low": 1.24e-06,
        "Volume": 4356547.69360079,
        "Last": 1.29e-06,
        "BaseVolume": 5.59000303,
        "TimeStamp": "2017-10-05T00:21:46.333",
        "Bid": 1.29e-06,
        "Ask": 1.31e-06,
        "OpenBuyOrders": 298,
        "OpenSellOrders": 2290,
        "PrevDay": 1.29e-06,
        "Created": "2016-05-16T06:44:15.287"
      },
      {
        "MarketName": "BTC-ABY",
        "High": 1.89e-06,
        "Low": 1.62e-06,
        "Volume": 31422008.3611497,
        "Last": 1.68e-06,
        "BaseVolume": 53.99330434,
        "TimeStamp": "2017-10-05T00:25:21.307",
        "Bid": 1.68e-06,
        "Ask": 1.7e-06,
        "OpenBuyOrders": 437,
        "OpenSellOrders": 4761,
        "PrevDay": 1.63e-06,
        "Created": "2014-10-31T01:43:25.743"
      }

当我试图只得到MarketName

curl -s https://bittrex.com/api/v1.1/public/getmarketsummaries/ | jq '.[] | select(.MarketName=="BTC-1ST")'

我收到以下错误

jq: error (at <stdin>:0): Cannot index boolean with string "MarketName"

其他错误

curl -s https://bittrex.com/api/v1.1/public/getmarketsummaries/ | jq '.[1]'

我明白了

jq: error (at <stdin>:0): Cannot index object with number

任何人都知道获得这些的正确命令吗?

curl
  • 2 个回答
  • 10960 Views
Martin Hope
uberrebu
Asked: 2017-08-06 10:29:18 +0800 CST

用于 RHEL ec2 实例上的额外 eni 的 ip 路由

  • 0

我注意到,当在 ec2 上添加额外的 ENI 时,让路由工作变得非常困难,并且没有任何文档可供参考。

我确实知道,如果使用 Amazon Linux ami,一切都会自动运行良好,无需任何额外工作。但是使用任何其他 ami,必须配置路由才能工作。

非亚马逊 Linux

[root@ip-10-11-2-20 ~]# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.3 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Red Hat Enterprise Linux Server release 7.3 (Maipo)

[root@ip-10-11-2-20 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.11.2.1       0.0.0.0         UG    100    0        0 eth0
0.0.0.0         10.11.2.1       0.0.0.0         UG    101    0        0 eth1
10.11.2.0       0.0.0.0         255.255.255.0   U     100    0        0 eth0
10.11.2.0       0.0.0.0         255.255.255.0   U     101    0        0 eth1
[root@ip-10-11-2-20 ~]# ip route
default via 10.11.2.1 dev eth0  proto static  metric 100
default via 10.11.2.1 dev eth1  proto static  metric 101
10.11.2.0/24 dev eth0  proto kernel  scope link  src 10.11.2.20  metric 100
10.11.2.0/24 dev eth1  proto kernel  scope link  src 10.11.2.247  metric 101

[root@ip-10-11-2-20 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 10.11.2.20  netmask 255.255.255.0  broadcast 10.11.2.255
        inet6 fe80::1012:30ff:feca:4bd0  prefixlen 64  scopeid 0x20<link>
        ether 12:12:30:ca:4b:d0  txqueuelen 1000  (Ethernet)
        RX packets 3065  bytes 258041 (251.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2375  bytes 351169 (342.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 10.11.2.247  netmask 255.255.255.0  broadcast 10.11.2.255
        inet6 fe80::1034:1bff:fe8d:c742  prefixlen 64  scopeid 0x20<link>
        ether 12:34:1b:8d:c7:42  txqueuelen 1000  (Ethernet)
        RX packets 473  bytes 22008 (21.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 58  bytes 5544 (5.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 140  bytes 11924 (11.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 140  bytes 11924 (11.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@ip-10-11-2-20 ~]# ping -c 3 10.11.2.20
PING 10.11.2.20 (10.11.2.20) 56(84) bytes of data.
64 bytes from 10.11.2.20: icmp_seq=1 ttl=64 time=0.013 ms
64 bytes from 10.11.2.20: icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from 10.11.2.20: icmp_seq=3 ttl=64 time=0.025 ms

--- 10.11.2.20 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.013/0.021/0.027/0.008 ms

[root@ip-10-11-2-20 ~]# ping -c 3 10.11.2.247
PING 10.11.2.247 (10.11.2.247) 56(84) bytes of data.
64 bytes from 10.11.2.247: icmp_seq=1 ttl=64 time=0.013 ms
64 bytes from 10.11.2.247: icmp_seq=2 ttl=64 time=0.024 ms
64 bytes from 10.11.2.247: icmp_seq=3 ttl=64 time=0.024 ms

--- 10.11.2.247 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.013/0.020/0.024/0.006 ms

亚马逊 Linux

[root@ip-10-11-2-149 ~]# cat  /etc/*release
NAME="Amazon Linux AMI"
VERSION="2017.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.03"
PRETTY_NAME="Amazon Linux AMI 2017.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2017.03

[root@ip-10-11-2-149 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.11.2.1       0.0.0.0         UG    0      0        0 eth0
0.0.0.0         10.11.2.1       0.0.0.0         UG    10001  0        0 eth1
10.11.2.0       0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.11.2.0       0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.169.254 0.0.0.0         255.255.255.255 UH    0      0        0 eth0

[root@ip-10-11-2-149 ~]# ip route
default via 10.11.2.1 dev eth0
default via 10.11.2.1 dev eth1  metric 10001
10.11.2.0/24 dev eth0  proto kernel  scope link  src 10.11.2.149
10.11.2.0/24 dev eth1  proto kernel  scope link  src 10.11.2.61
169.254.169.254 dev eth0

[root@ip-10-11-2-149 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 12:B2:B8:77:D0:F8
          inet addr:10.11.2.149  Bcast:10.11.2.255  Mask:255.255.255.0
          inet6 addr: fe80::10b2:b8ff:fe77:d0f8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
          RX packets:1490 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1441 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:129285 (126.2 KiB)  TX bytes:143368 (140.0 KiB)

eth1      Link encap:Ethernet  HWaddr 12:9B:45:32:EB:BA
          inet addr:10.11.2.61  Bcast:10.11.2.255  Mask:255.255.255.0
          inet6 addr: fe80::109b:45ff:fe32:ebba/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
          RX packets:263 errors:0 dropped:0 overruns:0 frame:0
          TX packets:347 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:16825 (16.4 KiB)  TX bytes:25705 (25.1 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:140 (140.0 b)  TX bytes:140 (140.0 b)

[root@ip-10-11-2-149 ~]# ping -c 3 10.11.2.149
PING 10.11.2.149 (10.11.2.149) 56(84) bytes of data.
64 bytes from 10.11.2.149: icmp_seq=1 ttl=255 time=0.018 ms
64 bytes from 10.11.2.149: icmp_seq=2 ttl=255 time=0.027 ms
64 bytes from 10.11.2.149: icmp_seq=3 ttl=255 time=0.026 ms

--- 10.11.2.149 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2035ms
rtt min/avg/max/mdev = 0.018/0.023/0.027/0.006 ms

[root@ip-10-11-2-149 ~]# ping -c 3 10.11.2.61
PING 10.11.2.61 (10.11.2.61) 56(84) bytes of data.
64 bytes from 10.11.2.61: icmp_seq=1 ttl=255 time=0.018 ms
64 bytes from 10.11.2.61: icmp_seq=2 ttl=255 time=0.027 ms
64 bytes from 10.11.2.61: icmp_seq=3 ttl=255 time=0.029 ms

--- 10.11.2.61 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2034ms
rtt min/avg/max/mdev = 0.018/0.024/0.029/0.007 ms

现在这是下面的问题...查看非 mazon Linux 如何 ping Amazon Linuxeth0上eth1的 ENI,但 Amazon Linux 无法 pingeth1非 Amazon Linux

INTER NETWORKING

非亚马逊 Linux

[root@ip-10-11-2-20 ~]# ping -c 3 10.11.2.149
PING 10.11.2.149 (10.11.2.149) 56(84) bytes of data.
64 bytes from 10.11.2.149: icmp_seq=1 ttl=255 time=0.629 ms
64 bytes from 10.11.2.149: icmp_seq=2 ttl=255 time=0.486 ms
64 bytes from 10.11.2.149: icmp_seq=3 ttl=255 time=0.472 ms

--- 10.11.2.149 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.472/0.529/0.629/0.070 ms

[root@ip-10-11-2-20 ~]# ping -c 3 10.11.2.61
PING 10.11.2.61 (10.11.2.61) 56(84) bytes of data.
64 bytes from 10.11.2.61: icmp_seq=1 ttl=255 time=0.595 ms
64 bytes from 10.11.2.61: icmp_seq=2 ttl=255 time=0.560 ms
64 bytes from 10.11.2.61: icmp_seq=3 ttl=255 time=0.522 ms

--- 10.11.2.61 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.522/0.559/0.595/0.029 ms

亚马逊 Linux

[root@ip-10-11-2-149 ~]# ping -c 3 10.11.2.20
PING 10.11.2.20 (10.11.2.20) 56(84) bytes of data.
64 bytes from 10.11.2.20: icmp_seq=1 ttl=64 time=0.446 ms
64 bytes from 10.11.2.20: icmp_seq=2 ttl=64 time=0.465 ms
64 bytes from 10.11.2.20: icmp_seq=3 ttl=64 time=0.481 ms

--- 10.11.2.20 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2030ms
rtt min/avg/max/mdev = 0.446/0.464/0.481/0.014 ms

[root@ip-10-11-2-149 ~]# ping -c 3 10.11.2.247
PING 10.11.2.247 (10.11.2.247) 56(84) bytes of data.
^C
--- 10.11.2.247 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2028ms

如何允许路由到eth1添加到 RHEL 7 ec2 实例的额外 ENI?

amazon-web-services
  • 2 个回答
  • 2275 Views
Martin Hope
uberrebu
Asked: 2017-07-11 17:18:25 +0800 CST

ansible 动态库存无法正常工作

  • 2

这是用于与 AWS 一起使用的动态清单

RHEL 7.3

python2-boto-2.45.0-3.el7.noarch

ANSIBLE 版本

ansible 2.3.1.0
config file = /projects/robomation/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.5 (default, Aug 2 2016, 04:20:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

我有几个资源正在运行,当我运行时

ec2.py --list

{
  "_meta": {
    "hostvars": {}
  }
}

此外,当我尝试运行针对具有某些标签的主机的 ansible 剧本时,我得到了这个

[WARNING]: Found both group and host with same name: localhost
...
...
...
skipping: no hosts matched

我在设置动态库存以正常工作时遇到问题。我有我的 ec2.ini 和 ec2.py 文件,并且 ec2.py 设置为可执行,我相信我的设置正确。此外,命令不返回错误,只是它在正文中不返回任何内容。

[root@robomation robomation]# env | grep ANSIBLE
ANSIBLE_HOSTS=/projects/robomation/inventory/ec2.py

[root@robomation robomation]# env | grep EC2_INI
EC2_INI_PATH=/projects/robomation/inventory/ec2.ini

[root@robomation robomation]# env | grep AWS
AWS_REGION=us-west-2

[root@robomation robomation]# inventory/ec2.py --list
{
  "_meta": {
    "hostvars": {}
  }
}
[root@robomation robomation]# ansible --version
ansible 2.3.1.0
  config file = /projects/robomation/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.5 (default, Aug  2 2016, 04:20:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

我该怎么做才能对动态库存进行故障排除?

更新:

pip freeze

boto3==1.4.4
botocore==1.5.82

rpm -qa | grep boto

python2-boto-2.45.0-3.el7.noarch
amazon-web-services
  • 1 个回答
  • 1966 Views
Martin Hope
uberrebu
Asked: 2017-04-09 23:06:21 +0800 CST

TERRAFORM 我如何拥有 1 个具有 2 个或更多 ecs 服务/任务定义的 ecs 集群?

  • 3

使用 Terraform,我尽最大努力找出如何创建 1 个 ECS 集群并在其下运行多个服务。所以基本上我有 2 个不同的容器我想用这个 1 个 ECS 集群运行。

我该怎么做呢?我见过很多例子,但通常是 1 个服务和 1 个 ECS 集群

所以从这个链接我得到了一个模板https://www.terraform.io/docs/providers/aws/d/ecs_task_definition.html

# Simply specify the family to find the latest ACTIVE revision in that family.
data "aws_ecs_task_definition" "mongo" {
  task_definition = "${aws_ecs_task_definition.mongo.family}"
}

resource "aws_ecs_cluster" "foo" {
  name = "foo"
}

resource "aws_ecs_task_definition" "mongo" {
  family = "mongodb"

  container_definitions = <<DEFINITION
[
  {
    "cpu": 128,
    "environment": [{
      "name": "SECRET",
      "value": "KEY"
    }],
    "essential": true,
    "image": "mongo:latest",
    "memory": 128,
    "memoryReservation": 64,
    "name": "mongodb"
  }
]
DEFINITION
}

resource "aws_ecs_service" "mongo" {
  name          = "mongo"
  cluster       = "${aws_ecs_cluster.foo.id}"
  desired_count = 2

  # Track the latest ACTIVE revision
  task_definition = "${aws_ecs_task_definition.mongo.family}:${max("${aws_ecs_task_definition.mongo.revision}", "${data.aws_ecs_task_definition.mongo.revision}")}"
}

所以可以说我想添加一个节点应用程序服务,它看起来如何?并让它们都在同一个集群上运行

谢谢!

docker
  • 3 个回答
  • 5023 Views
Martin Hope
uberrebu
Asked: 2017-03-13 12:12:31 +0800 CST

如何使用 supervisord 重新启动 php7-fpm?

  • 0

我有一个用于 apache 和 php7-fpm 的自定义 docker 映像,但是每当我对 php ini 文件进行更改并在映像构建期间的这些更改之后使用 supervisord 重新启动 php7-fpm,然后从映像运行容器之前,我注意到我一直无法使 php7-fpm 重新启动。所以我对 php ini 文件所做的更改永远不会得到反映

但是当我登录到正在运行的容器并尝试重新启动 php7-fpm 时,我会看到这些更改

这是我的supervisord配置

[supervisord]
nodaemon=true

[program:php-fpm7.0]
command = /usr/sbin/php-fpm7.0 -c /etc/php/7.0/fpm/php-fpm.conf
autorestart=true

[program:apache2]
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
autorestart=true

这是我的 start.sh 脚本

#!/bin/bash
set -e
echo "ServerName localhost" >> /etc/apache2/apache2.conf
#echo "export HOSTNAME=$(hostname)" >> /etc/apache2/envvars
sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.0/fpm/php.ini
sed -i -e "s/;short_open_tag = Off/short_open_tag = On/g" /etc/php/7.0/fpm/php.ini
sed -i -e "s/;display_errors = Off/display_errors = On/g" /etc/php/7.0/fpm/php.ini
sed -ri 's/^upload_max_filesize\s*=\s*.+/upload_max_filesize = 450M/g' /etc/php/7.0/fpm/php.ini
sed -ri 's/^max_input_time\s*=\s*.+/max_input_time = 300/g' /etc/php/7.0/fpm/php.ini
sed -ri 's/^memory_limit\s*=\s*.+/memory_limit = 640M/g' /etc/php/7.0/fpm/php.ini
sed -ri 's/^post_max_size\s*=\s*.+/post_max_size = 450M/g' /etc/php/7.0/fpm/php.ini
sed -ri 's/^max_execution_time\s*=\s*.+/max_execution_time = 300/g' /etc/php/7.0/fpm/php.ini
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/7.0/fpm/php-fpm.conf
sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php/7.0/fpm/pool.d/www.conf
sed -i -e "s/pm.max_children = 5/pm.max_children = 9/g" /etc/php/7.0/fpm/pool.d/www.conf
sed -i -e "s/pm.start_servers = 2/pm.start_servers = 3/g" /etc/php/7.0/fpm/pool.d/www.conf
sed -i -e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" /etc/php/7.0/fpm/pool.d/www.conf
sed -i -e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" /etc/php/7.0/fpm/pool.d/www.conf
sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/g" /etc/php/7.0/fpm/pool.d/www.conf
sed -i -e "s/;clear_env = no/clear_env = no/g" /etc/php/7.0/fpm/pool.d/www.conf

请帮助如何在创建 docker 映像时使用脚本对 php ini 文件进行更改时重新启动php7-fpmstart.sh

附言

您可能想知道为什么我只需要启动 php7-fpm 就需要重新启动它,没有办法让 php7-fpm 与 docker 一起工作,除非我实际上首先在我的 docker 文件中启动它,如下所示。每当我从 dockerfile 中删除该行时,它都不起作用。如果有人在 docker 中有 apache 2.4 和 php7-fpm 设置,但没有这种方式,请给我发送他们图像的链接!

RUN service php7.0-fpm start

谢谢

php-fpm docker php7 supervisord
  • 1 个回答
  • 10147 Views
Martin Hope
uberrebu
Asked: 2016-10-11 13:00:40 +0800 CST

从另一个 docker 镜像创建数据容器

  • 1

我有一个大约900MB的 docker 映像,它有一个目录/data,我想要的所有数据都在其中,还有一个/data/.git我想排除的目录。

我想创建一个数据容器(例如使用busybox图像),其中只有/data排除/data/.git目录下的数据

我如何以最有效的方式做到这一点?

/data不包括只有/data/.git大约130MB

所以基本上我将拥有大约 130MB 到 200MB 的数据容器,而另一个 900MB 巨大的 docker 映像

谢谢

linux busybox docker containers
  • 1 个回答
  • 118 Views
Martin Hope
uberrebu
Asked: 2016-07-25 11:32:01 +0800 CST

将非 www 重定向到 www 以使用 cloudfront 进行静态网站托管

  • 0

我几乎到处都在搜索如何使用云端重定向。我为静态网站托管创建了一个 s3 存储桶,甚至在那里使用了他们的重定向,BUT因为我没有通过 cloudfront 为整个网站提供服务,现在 cloudfront 不遵循该重定向规则。

如何使云端重定向非 www 到 www?

amazon-s3 amazon-web-services amazon-cloudfront amazon-route53
  • 1 个回答
  • 1881 Views
Martin Hope
uberrebu
Asked: 2016-07-16 12:56:03 +0800 CST

我如何在 docker 中开始收集?

  • 3

我正在尝试在docker中启动collectd,我已经尝试了从运行命令到在dockerfile中启动collectd到使用脚本到运行service collectd start到使用supervisord但仍然无法正常工作的所有内容

我的 supervisord.conf 文件是

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)

[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10           ; (num of main logfile rotation backups;default 10)
loglevel=info                ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false               ; (start in foreground if true;default false)
minfds=1024                  ; (min. avail startup file descriptors;default 1024)
minprocs=200                 ; (min. avail process descriptors;default 200)
user=root            ;

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket

[program:collectd]
command=/usr/sbin/collectd -C /etc/collectd/collectd.conf -f
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

我也尝试在我的 Dockerfile 中运行它

RUN service collectd start

通过 Dockerfile 正在使用 Ubuntu 16.04,我安装了 collectd,apt-get install collectd它为我精美地安装了 collectd 版本 5.5.1(这就是我想要的)

无论如何,当我运行容器并ps aux看到

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.6  0.0  18180  2000 ?        Ss   20:27   0:00 bash
root        11  0.0  0.0  34364  1544 ?        R+   20:27   0:00 ps aux

所以基本上collectd仍然没有运行

在容器内,我开始使用它,service collectd start它工作正常

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  18180  2008 ?        Ss   20:27   0:00 bash
root        27  0.0  0.0   4300   320 ?        Ss   20:27   0:00 /usr/sbin/collectdmon -P /var/run/collectd.pid -- -C /etc/collectd
root        30  0.0  0.0 799820  2368 ?        Sl   20:27   0:00 collectd -C /etc/collectd/collectd.conf -f
root        42  0.0  0.0  34364  1544 ?        R+   20:30   0:00 ps aux

所以基本上我如何在运行 docker 镜像时自动运行 collectd ?

PS即使我不必使用supervisrod,很好,我只是想要一种在我运行容器时运行collectd的方法

谢谢

collectd更新:容器内运行的单个命令也启动 collectd

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  18180  2020 ?        Ss   21:09   0:00 bash
root        36  0.0  0.0 799820  1680 ?        Ssl  21:10   0:00 collectd
root        47  0.0  0.0  34364  1544 ?        R+   21:10   0:00 ps aux
docker collectd supervisord
  • 1 个回答
  • 1615 Views
Martin Hope
uberrebu
Asked: 2016-06-27 12:13:41 +0800 CST

如何使用 supervisord 启动 php7.0-fpm?

  • 5

我正在尝试用 apache2 和 nginx 用 php7.0-fpm 构建一个 dockerized ubuntu 16.04lts

我用过但没用的命令

[program:php-fpm7.0]
command = /usr/sbin/php-fpm7.0 --daemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

和

[program:php-fpm7.0]
command = /usr/sbin/php-fpm7.0 -c /etc/php/7.0/fpm/php-fpm.conf
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

和

[program:php-fpm7.0]
command = /usr/sbin/php-fpm7.0 -c /etc/php/7.0/fpm
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

以下是当我尝试作为容器运行时来自 docker 的错误日志

来自 apache2 容器

2016-06-26 20:04:21,488 CRIT Set uid to user 0
2016-06-26 20:04:21,496 INFO RPC interface 'supervisor' initialized
2016-06-26 20:04:21,496 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2016-06-26 20:04:21,496 INFO supervisord started with pid 8
2016-06-26 20:04:22,499 INFO spawned: 'php-fpm7.0' with pid 11
2016-06-26 20:04:22,500 INFO spawned: 'apache2' with pid 12
2016-06-26 20:04:22,571 INFO exited: apache2 (exit status 0; not expected)
[26-Jun-2016 20:04:22] ERROR: Unable to create the PID file (/run/php/php7.0-fpm.pid).: No such file or directory (2)
[26-Jun-2016 20:04:22] ERROR: FPM initialization failed
2016-06-26 20:04:22,609 INFO exited: php-fpm7.0 (exit status 78; not expected)
2016-06-26 20:04:23,611 INFO spawned: 'php-fpm7.0' with pid 74
2016-06-26 20:04:23,613 INFO spawned: 'apache2' with pid 75
httpd (pid 16) already running
2016-06-26 20:04:23,669 INFO exited: apache2 (exit status 0; not expected)
[26-Jun-2016 20:04:23] ERROR: Unable to create the PID file (/run/php/php7.0-fpm.pid).: No such file or directory (2)
[26-Jun-2016 20:04:23] ERROR: FPM initialization failed
2016-06-26 20:04:23,694 INFO exited: php-fpm7.0 (exit status 78; not expected)
2016-06-26 20:04:25,698 INFO spawned: 'php-fpm7.0' with pid 79
2016-06-26 20:04:25,700 INFO spawned: 'apache2' with pid 80
httpd (pid 16) already running
2016-06-26 20:04:25,758 INFO exited: apache2 (exit status 0; not expected)
[26-Jun-2016 20:04:25] ERROR: Unable to create the PID file (/run/php/php7.0-fpm.pid).: No such file or directory (2)
[26-Jun-2016 20:04:25] ERROR: FPM initialization failed
2016-06-26 20:04:25,784 INFO exited: php-fpm7.0 (exit status 78; not expected)
2016-06-26 20:04:28,788 INFO spawned: 'php-fpm7.0' with pid 84
2016-06-26 20:04:28,789 INFO spawned: 'apache2' with pid 85
httpd (pid 16) already running
2016-06-26 20:04:28,847 INFO exited: apache2 (exit status 0; not expected)
2016-06-26 20:04:28,857 INFO gave up: apache2 entered FATAL state, too many start retries too quickly
[26-Jun-2016 20:04:28] ERROR: Unable to create the PID file (/run/php/php7.0-fpm.pid).: No such file or directory (2)
[26-Jun-2016 20:04:28] ERROR: FPM initialization failed
2016-06-26 20:04:28,872 INFO exited: php-fpm7.0 (exit status 78; not expected)
2016-06-26 20:04:29,873 INFO gave up: php-fpm7.0 entered FATAL state, too many start retries too quickly

和

来自 nginx 容器

2016-06-26 11:19:02,307 CRIT Set uid to user 0
2016-06-26 11:19:02,320 INFO RPC interface 'supervisor' initialized
2016-06-26 11:19:02,320 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2016-06-26 11:19:02,321 INFO supervisord started with pid 14
2016-06-26 11:19:03,323 INFO spawned: 'php7.0-fpm' with pid 17
2016-06-26 11:19:03,324 INFO spawned: 'nginx' with pid 18
[26-Jun-2016 11:19:03] ERROR: unable to bind listening socket for address '/run/php/php7.0-fpm.sock': No such file or directory (2)
[26-Jun-2016 11:19:03] ERROR: FPM initialization failed
2016-06-26 11:19:03,406 INFO exited: php7.0-fpm (exit status 78; not expected)
2016-06-26 11:19:04,409 INFO spawned: 'php7.0-fpm' with pid 20
2016-06-26 11:19:04,409 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[26-Jun-2016 11:19:04] ERROR: unable to bind listening socket for address '/run/php/php7.0-fpm.sock': No such file or directory (2)
[26-Jun-2016 11:19:04] ERROR: FPM initialization failed
2016-06-26 11:19:04,465 INFO exited: php7.0-fpm (exit status 78; not expected)
2016-06-26 11:19:06,470 INFO spawned: 'php7.0-fpm' with pid 21
[26-Jun-2016 11:19:06] ERROR: unable to bind listening socket for address '/run/php/php7.0-fpm.sock': No such file or directory (2)
[26-Jun-2016 11:19:06] ERROR: FPM initialization failed
2016-06-26 11:19:06,527 INFO exited: php7.0-fpm (exit status 78; not expected)
2016-06-26 11:19:09,532 INFO spawned: 'php7.0-fpm' with pid 30
[26-Jun-2016 11:19:09] ERROR: unable to bind listening socket for address '/run/php/php7.0-fpm.sock': No such file or directory (2)
[26-Jun-2016 11:19:09] ERROR: FPM initialization failed
2016-06-26 11:19:09,592 INFO exited: php7.0-fpm (exit status 78; not expected)
2016-06-26 11:19:10,594 INFO gave up: php7.0-fpm entered FATAL state, too many start retries too quickly
2016/06/26 11:19:13 [info] 19#19: *1 client closed connection while waiting for request, client: 192.168.99.1, server: 0.0.0.0:80

所以我的问题是如何正确使用supervisord在 docker 容器中启动 php7.0-fpm/php-fpm7.0。

还要了解,当我登录这些容器并运行此命令时,它就会开始工作!我究竟做错了什么

service php7.0-fpm start

当我在运行容器时 fpm 无法启动后运行上述命令时,它就可以工作了。如何使用 supervisord 执行此操作,因此我不需要手动从 init.d 开始

fastcgi php-fpm docker php7 supervisord
  • 3 个回答
  • 29110 Views
Martin Hope
uberrebu
Asked: 2016-06-20 19:56:12 +0800 CST

elk 堆栈错误“无法获取映射是否有与模式匹配的索引”

  • 3

我正在尝试在 Ubuntu 16.04 LTS 上使用 collectd 设置 ELK 堆栈(可用的堆栈几乎最新版本) kibana 位于 nginx 代理后面(遵循本指南https://www.digitalocean.com/community/tutorials/how-to-安装-elasticsearch-logstash-and-kibana-elk-stack-on-ubuntu-16-04)

一切看起来都很好,直到进入 kibana 仪表板

Index Patterns 

Warning No default index pattern. You must select or create one to continue.

unable to fetch mapping do you have indices matching the pattern

ELK 堆栈位于一台服务器上,因此所有内容都在本地主机上

以下是我运行来检查我的配置的命令

:~# curl 127.0.0.1:9200`
{
  "name" : "Flex",
  "cluster_name" : "elk-00",
  "version" : {
    "number" : "2.3.3",
    "build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde",
    "build_timestamp" : "2016-05-17T15:40:04Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"


:~# service logstash configtest
Configuration OK

我的问题,非常具体

1. 如何创建默认索引文件?

2. 这个默认索引文件的路径是什么?我也听说过 .kibana,这个文件 .kibana 位于哪里?

3. 为什么没有自动为我创建这个索引文件?我该怎么做才能确保它自动工作而无需手动执行任何其他操作?

在此处输入图像描述

在此处输入图像描述

elasticsearch elk collectd kibana logstash
  • 1 个回答
  • 11556 Views
Martin Hope
uberrebu
Asked: 2016-06-20 12:14:05 +0800 CST

PHP解析错误语法错误,文件意外结束

  • 1

当我在 LEMP 设置 nginx 1.10/PHP 7 时,我一直收到此错误,我认为这是因为 PHP 7,现在我使用 nginx 1.4.6/PHP 5.5.9 设置了一个新服务器

2016/06/19 15:45:18 [error] 4094#0: *1 FastCGI sent in stderr: "PHP message: PHP Parse error:  syntax error, unexpected end of file in /var/www/www.example.com/public/wp-content/themes/techs/functions.php on line 141" while reading response header from upstream, client: 10.0.0.11, server: www.example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.com"

现在导致此错误的文件在这里,我注意到该行是空的最后一行,我试图删除该行但不会被删除。谁能指出导致此错误的原因?

纳米/var/www/www.example.com/public/wp-content/themes/techs/functions.php

第 141 行是结束标签之后/下方的空行;每次删除该行的尝试都失败了

<?php

if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
        add_theme_support( 'post-thumbnails' );
        set_post_thumbnail_size( 75, 56, true ); // Normal post thumbnails
        add_image_size( 'single-post-thumbnail', 273, 273 ); // Permalink thumbnail size
}


/*register_sidebar(array(
        'name'=>'sidebar',
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>',
));
*/

# Displays a list of popular posts
function gtt_popular_posts($num, $pre='<li>', $suf='</li>', $excerpt=true) {
        global $wpdb;
        $querystr = "SELECT $wpdb->posts.post_title,$wpdb->posts.post_date_gmt, $wpdb->posts.ID, $wpdb->posts.post_content FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ORDER BY $wpdb->posts.comment_count DESC LIMIT $num";
        $myposts = $wpdb->get_results($querystr, OBJECT);
        foreach($myposts as $post) {
                echo $pre;
                ?><div class="fpimg">

          <img src="<?php get_post_thumbnail($post->ID); ?>" />
        </div>
                <div class="fpost">
        <a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title ?></a><br />
                <?php if (function_exists('time_since')) {echo time_since(abs(strtotime($post->post_date_gmt . " GMT")), time()) . " ago";} else {the_time('F jS, Y');} ?>
                </div>
                <?php echo $suf;
        }
}


function get_recent_posts($num) {
      $recent_posts = wp_get_recent_posts($num);
      foreach($recent_posts as $post){
          ?>
          <li><div class="fpimg"> <?php echo '<a href="' . get_permalink($post["ID"]) . '" title="Look '.$post["post_title"].'" >'; ?>
          <img src="<?php get_post_thumbnail($post["ID"]); ?>" />
          </div>
          <div class="fpost">
        <?php echo '<a href="' . get_permalink($post["ID"]) . '" title="Look '.$post["post_title"].'" >' .   $post["post_title"].'</a>  ';?>
                <br />
                <?php if (function_exists('time_since')) {echo time_since(abs(strtotime($post["post_date_gmt"] . " GMT")), time()) . " ago";} else {the_time('F jS, Y');} ?>
                </div>
                </li>
    <? }


         }
function time_since($older_date, $newer_date = false)
        {
        // array of time period chunks
        $chunks = array(
        array(60 * 60 * 24 * 365 , 'year'),
        array(60 * 60 * 24 * 30 , 'month'),
        array(60 * 60 * 24 * 7, 'week'),
        array(60 * 60 * 24 , 'day'),
        array(60 * 60 , 'hour'),
        array(60 , 'minute'),
        );

        // $newer_date will equal false if we want to know the time elapsed between a date and the current time
        // $newer_date will have a value if we want to work out time elapsed between two known dates
        $newer_date = ($newer_date == false) ? (time()+(60*60*get_settings("gmt_offset"))) : $newer_date;

        // difference in seconds
        $since = $newer_date - $older_date;

        // we only want to output two chunks of time here, eg:
        // x years, xx months
        // x days, xx hours
        // so there's only two bits of calculation below:

        // step one: the first chunk
        for ($i = 0, $j = count($chunks); $i < $j; $i++)
                {
                $seconds = $chunks[$i][0];
                $name = $chunks[$i][1];

                // finding the biggest chunk (if the chunk fits, break)
                if (($count = floor($since / $seconds)) != 0)
                        {
                        break;
                        }
                }

        // set output var
        $output = ($count == 1) ? '1 '.$name : "$count {$name}s";

        // step two: the second chunk
        if ($i + 1 < $j)
                {
                $seconds2 = $chunks[$i + 1][0];
                $name2 = $chunks[$i + 1][1];

                if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0)
                        {
                        // add to output var
                        $output .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s";
                        }
                }

        return $output;
        }
function get_post_thumbnail($pid) {
$files = get_children('post_parent='.$pid.'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'large', false);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$thumb=wp_get_attachment_thumb_url($num);
print $thumb;
else:
echo  bloginfo('template_directory')."/images/smallimg.jpg";
endif;
}
function get_post_thumbnails() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'large', false);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$thumb=wp_get_attachment_thumb_url($num);
print $thumb;
else:
echo  bloginfo('template_directory')."/images/smallimg.jpg";
endif;
}
?>
php nginx php5 php-fpm
  • 2 个回答
  • 12593 Views
Martin Hope
uberrebu
Asked: 2016-04-12 08:34:51 +0800 CST

引导全新安装 UbuntuOS 的问题

  • 0

我的服务器上有 2 个硬盘驱动器,我之前在其中一个硬盘驱动器上安装了 CentOS(不确定是哪个,但我猜是第二个)

我会在第一个上安装新的 Ubuntu 14.04LTS,但是在成功安装后(我假设它已经重新分区了我的硬盘),当它重新启动时,我收到了这个错误

error: file '/grub/i386-pc/normal.mod' not found

我在下面附上了截图。

我尝试使用救援模式来解决问题,然后被带到一个屏幕(也参见下面的屏幕截图),要求选择我想要的启动设备,当我选择/dev/sda1它时说我无法使用它。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

1. 我该如何解决这个问题?

和/或

2. 在开始另一个全新安装之前,如何先清除 2 个硬盘驱动器上的所有内容?(说实话对我来说可能更容易)

有什么帮助吗?

boot grub ubuntu-14.04
  • 2 个回答
  • 54 Views
Martin Hope
uberrebu
Asked: 2016-02-16 21:31:59 +0800 CST

使用不同端口在同一服务器上设置多个 https

  • -2

我正在尝试通过 apache 或 nginx virtualhost 设置多个 https 网站,但我注意到我必须将端口附加到 IP 地址的末尾才能查看使用非默认 443 ssl 端口的网站的 https

是否可以在使用不同端口的同一服务器上拥有多个 https 网站?如果是,那么如何在不需要在末尾附加非默认端口的情况下做到这一点

我试过的

# Ensure that Apache listens on port 80 and all ssl ports
Listen 80 
Listen 443
Listen 543


# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
NameVirtualHost *:443
NameVirtualHost *:543

<VirtualHost 192.168.101.44:443>
DocumentRoot /www/example1
ServerName www.example1.com

# Other directives here

</VirtualHost>

<VirtualHost 192.168.101.54:543>
DocumentRoot /www/example2
ServerName www.example2.org

# Other directives here

</VirtualHost>

按此顺序,将能够分别访问https://www.example1.com和https://www.example2.org上的网站

这可能吗?阿帕奇?Nginx?我使用两个网络服务器,所以想知道它是否可以与其中一个或两个一起工作。如果需要,我可以将问题编辑得更清楚。

谢谢

apache-2.2
  • 2 个回答
  • 5930 Views
Martin Hope
uberrebu
Asked: 2016-02-02 18:35:47 +0800 CST

Windows Server 2012 R2 DNS 内部和外部记录问题

  • -1

我在使用 Windows Server 2012 R2 上的 DNS 作为 Active Directory 域控制器和 DNS 服务器时遇到问题

我希望能够设置将使用本地 DNS 服务器在内部解析的某些记录,但如果记录不存在,则会发送请求以进行外部 DNS 查询。Windows Server 2012R2 可以做到这一点吗?

区

[windows server 2012 DNS server管理的内部记录]

某事.com

sub1    A   10.10.0.1
sub2    A   10.10.0.2
sub3    CNAME sub1.something.com.

[由外部 DNS 提供商管理的外部记录]

某事.com

sub4    A    54.26.45.24
sub5    A    184.34.56.25
sub6    CNAME   images.cdnprovider.net.

因此,如果在内部 DNS 中请求记录(例如 sub1.something.com、sub2.something.com 和 sub3.something.com)并且这些记录不存在(对于例如 sub4.something.com、sub5.something.com 和 sub6.something.com) 那么它应该出去并适当地解决

我正在尝试这样做,因此我不必将所有记录从外部 DNS 提供商复制到内部 DNS。所以这样我只添加需要在本地解决的记录,对于那些没有在本地添加的记录,它应该出去解决。

我可以这样做吗?

如果我的问题不是很清楚,请告诉我,我会立即对其进行编辑。

更新:基本上与主机文件在 Windows 操作系统(和其他操作系统)上的工作方式相同的东西,如果记录存在,那么它使用本地主机记录,如果不存在,它就会消失。

谢谢

domain-name-system
  • 1 个回答
  • 636 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