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

klor's questions

Martin Hope
klor
Asked: 2020-10-15 08:32:59 +0800 CST

仅允许来自主机服务器的反向代理访问

  • 0

我有两台服务器 A)前端服务器(IP 11.22.33.44),B)后端服务器(IP 22.33.44.55)。两者都使用 Debian Linux 和 Apache 服务器。

A) 前端服务器使用反向代理来显示 B) 后端服务器的内容。我想将后端服务器的 Apache 访问限制为 ip 11.22.33.44(应该只能从 A)前端服务器访问)。后端服务器侦听启用 SSL 的端口 1111 和 2222(为两个不同的反向代理站点提供服务)。

我在后端服务器上试过:

<Proxy "*">
    Require ip 11.22.33.44
</Proxy>

和

<Proxy "*">
    order deny,allow
    Deny from from all
    Allow from 11.22.33.44
</Proxy>

但我没有成功。我仍然可以通过 URL https://22.33.44.55:1111的网络浏览器访问。

将后端服务器的访问限制为前端服务器的 IP 地址的任何其他想法?

debian reverse-proxy apache-2.4 restrictions backend
  • 1 个回答
  • 226 Views
Martin Hope
klor
Asked: 2020-02-28 12:10:29 +0800 CST

Debian 9.12 中的 libc6 依赖项不匹配

  • 2

我在 Debian 9.12 中遇到了以下 libc6 依赖问题。

sudo apt install libc6-dev

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.24-11+deb9u4) but 2.27-6 is to be installed
             Depends: libc-dev-bin (= 2.24-11+deb9u4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我该如何解决?

EDIT1:apt策略libc6

libc6:
  Installed: 2.27-6
  Candidate: 2.27-6
  Version table:
 *** 2.27-6 100
        100 /var/lib/dpkg/status
     2.24-11+deb9u4 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
     2.24-11+deb9u1 500
        500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages

编辑2:

apt install libc6/stretch libc6-dev/stretch libc-dev-bin/stretch
Reading package lists... Done
Building dependency tree
Reading state information... Done
Selected version '2.24-11+deb9u4' (Debian:9.12/oldstable [amd64]) for 'libc6'
Selected version '2.24-11+deb9u4' (Debian:9.12/oldstable [amd64]) for 'libc6-dev'
Selected version '2.24-11+deb9u4' (Debian:9.12/oldstable [amd64]) for 'libc-dev-bin'
The following additional packages will be installed:
linux-libc-dev
Suggested packages:
glibc-doc locales
The following packages will be REMOVED:
libc-bin locales sudo
The following NEW packages will be installed:
libc-dev-bin libc6-dev linux-libc-dev
The following packages will be DOWNGRADED:
libc6
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
libc-bin
0 upgraded, 3 newly installed, 1 downgraded, 3 to remove and 0 not upgraded.
Need to get 6,797 kB of archives.
After this operation, 1,437 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?]
linux debian dependencies debian-stretch libc6
  • 2 个回答
  • 9868 Views
Martin Hope
klor
Asked: 2020-01-09 10:05:02 +0800 CST

openSUSE:Cron 日志文件出现“权限被拒绝”错误

  • 0

使用:openSUSE Leap 42.2

/etc/cron.d/mysite 文件内容:

* * * * * wwwrun /usr/bin/php /srv/www/mysite/cron.php >> /var/log/apache2/mysite.cron 2>&1

/etc/cron.d/ 目录内容:

/etc/cron.d # ls -ls
total 12
4 -rw------- 1 root root 142 May  7  2018 autologout
4 -rw-r--r-- 1 root root 289 Jan  8 14:33 mysite
4 -rw------- 1 root root 369 May  7  2018 seccheck

邮件信息:

Message 103:
From [email protected]  Wed Jan  8 18:52:01 2020
X-Original-To: wwwrun
Delivered-To: [email protected]
From: "(Cron Daemon)" <[email protected]>
To: [email protected]
Subject: Cron <wwwrun@mysite1> /usr/bin/php /srv/www/mysite/cron.php >> /var/log/apache2/mysite.cron 2>&1
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=312343>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/11>
X-Cron-Env: <LC_CTYPE=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/var/lib/wwwrun>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=wwwrun>
X-Cron-Env: <USER=wwwrun>
Date: Wed,  8 Jan 2020 18:52:01 +0100 (CET)

/bin/sh: /var/log/apache2/mysite.cron: Permission denied

mysite.cron 日志文件

ls -la /var/log/apache2/mysite.cron
-rw-rw-rw- 1 wwwrun www 953 Jan  8 14:08 /var/log/apache2/mysite.cron

如何解决这个问题?

执行

/usr/bin/php /srv/www/mysite/cron.php >> /var/log/apache2/mysite.cron 2>&1

从终端作为root,执行良好,没有权限错误。

cron
  • 1 个回答
  • 484 Views
Martin Hope
klor
Asked: 2019-11-29 00:21:04 +0800 CST

Debian:“apt install build-essential”由于未满足的依赖关系而失败

  • 5

使用 Debian Stretch v9.11。

我尝试安装 build-essential,但由于未满足的依赖关系而失败:

sudo apt install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed or
                            libc-dev
                   Depends: g++ (>= 4:6.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

apt-cache 策略显示:

apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://security.debian.org/debian-security stretch/updates/non-free amd64 Packages
     release v=9,o=Debian,a=oldstable,n=stretch,l=Debian-Security,c=non-free,b=amd64
     origin security.debian.org
 500 http://security.debian.org/debian-security stretch/updates/contrib amd64 Packages
     release v=9,o=Debian,a=oldstable,n=stretch,l=Debian-Security,c=contrib,b=amd64
     origin security.debian.org
 500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
     release v=9,o=Debian,a=oldstable,n=stretch,l=Debian-Security,c=main,b=amd64
     origin security.debian.org
 500 http://deb.debian.org/debian stretch/non-free amd64 Packages
     release v=9.11,o=Debian,a=oldstable,n=stretch,l=Debian,c=non-free,b=amd64
     origin deb.debian.org
 500 http://deb.debian.org/debian stretch/contrib amd64 Packages
     release v=9.11,o=Debian,a=oldstable,n=stretch,l=Debian,c=contrib,b=amd64
     origin deb.debian.org
 500 http://deb.debian.org/debian stretch/main amd64 Packages
     release v=9.11,o=Debian,a=oldstable,n=stretch,l=Debian,c=main,b=amd64
     origin deb.debian.org

我在 /etc/apt/sources.list 中有以下内容:

# deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official amd64 DVD Binary-1 20180714-10:25]/ stretch contrib main

deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free

# deb http://deb.debian.org/debian stretch-updates main
# deb-src http://deb.debian.org/debian stretch-updates main


# deb http://deb.debian.org/debian-security/ stretch/updates main
# deb-src http://deb.debian.org/debian-security/ stretch/updates main

deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free

# add backports
# deb http://ftp.debian.org/debian stretch-backports main


# stretch-updates, previously known as 'volatile'
# A network mirror was not selected during install.  The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://deb.debian.org/debian/ stretch-updates main contrib
# deb-src http://deb.debian.org/debian/ stretch-updates main contrib

EDIT1:apt-cache 策略 libc6-dev 显示:

apt-cache policy libc6-dev
libc6-dev:
  Installed: (none)
  Candidate: 2.24-11+deb9u4
  Version table:
     2.24-11+deb9u4 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
     2.24-11+deb9u1 500
        500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages

apt-cache policy g++ 显示:

apt-cache policy g++
g++:
  Installed: (none)
  Candidate: 4:6.3.0-4
  Version table:
     4:6.3.0-4 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages

EDIT2: 我deb http://ftp.de.debian.org/debian buster main在/etc/apt/sources.list.d/.mc.list

我记得,有一次我必须安装一个更新的 mc,它有特定的错误修复。

编辑3:

apt update
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease
Hit:3 http://deb.debian.org/debian stretch Release
Fetched 94.3 kB in 1s (69.7 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

apt-get install --fix-broken
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

编辑4:

sudo apt install libc6-dev g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libc6-dev : Depends: libc6 (= 2.24-11+deb9u4) but 2.27-6 is to be installed
Depends: libc-dev-bin (= 2.24-11+deb9u4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: g++ (>= 4:6.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

编辑5

sudo aptitude -f install build-essential
The following NEW packages will be installed:
build-essential dpkg-dev{a} fakeroot{a} g++{a} g++-6{a} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} libalgorithm-merge-perl{a} libc-dev-bin{ab} libc6-dev{ab} libdpkg-perl{a} libfakeroot{a} libfile-fcntllock-perl{a} libstdc++-6-dev{a} linux-libc-dev{a} manpages-dev{a} 0 packages upgraded, 16 newly installed, 0 to remove and 0 not upgraded. Need to get 17.9 MB of archives. After unpacking 69.7 MB will be used.
The following packages have unmet dependencies:
libc6-dev : Depends: libc6 (= 2.24-11+deb9u4) but 2.27-6 is installed
libc-dev-bin : Depends: libc6 (< 2.25) but 2.27-6 is installed
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) build-essential [Not Installed]
2) g++ [Not Installed]
3) g++-6 [Not Installed]
4) libc-dev-bin [Not Installed]
5) libc6-dev [Not Installed]
6) libstdc++-6-dev [Not Installed]

Leave the following dependencies unresolved:
7) dpkg-dev recommends build-essential



Accept this solution? [Y/n/q/?]
The following NEW packages will be installed:
dpkg-dev{a} fakeroot{a} libalgorithm-diff-perl{a}
libalgorithm-diff-xs-perl{a} libalgorithm-merge-perl{a}
libdpkg-perl{a} libfakeroot{a} libfile-fcntllock-perl{a}
manpages-dev{a}
The following packages are RECOMMENDED but will NOT be installed: build-essential
0 packages upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,267 kB of archives. After unpacking 8,773 kB will be used.
Do you want to continue? [Y/n/?]
Get: 1 http://deb.debian.org/debian stretch/main amd64 libdpkg-perl all 1.18.25 [1,287 kB]
Get: 2 http://deb.debian.org/debian stretch/main amd64 dpkg-dev all 1.18.25 [1,595 kB]
Get: 3 http://deb.debian.org/debian stretch/main amd64 libfakeroot amd64 1.21-3.1 [45.7 kB]
Get: 4 http://deb.debian.org/debian stretch/main amd64 fakeroot amd64 1.21-3.1 [85.6 kB]
Get: 5 http://deb.debian.org/debian stretch/main amd64 libalgorithm-diff-perl all 1.19.03-1 [48.7 kB]
Get: 6 http://deb.debian.org/debian stretch/main amd64 libalgorithm-diff-xs-perl amd64 0.04-4+b2 [11.6 kB]
Get: 7 http://deb.debian.org/debian stretch/main amd64 libalgorithm-merge-perl all 0.08-3 [12.7 kB]
Get: 8 http://deb.debian.org/debian stretch/main amd64 libfile-fcntllock-perl amd64 0.22-3+b2 [35.3 kB]
Get: 9 http://deb.debian.org/debian stretch/main amd64 manpages-dev all 4.10-2 [2,145 kB]
Fetched 5,267 kB in 0s (15.0 MB/s)
Selecting previously unselected package libdpkg-perl.
(Reading database ... 38475 files and directories currently installed.)
Preparing to unpack .../0-libdpkg-perl_1.18.25_all.deb ...
Unpacking libdpkg-perl (1.18.25) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../1-dpkg-dev_1.18.25_all.deb ...
Unpacking dpkg-dev (1.18.25) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../2-libfakeroot_1.21-3.1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.21-3.1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../3-fakeroot_1.21-3.1_amd64.deb ...
Unpacking fakeroot (1.21-3.1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../4-libalgorithm-diff-perl_1.19.03-1_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.03-1) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../5-libalgorithm-diff-xs-perl_0.04-4+b2_amd64.deb ...Unpacking libalgorithm-diff-xs-perl (0.04-4+b2) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../6-libalgorithm-merge-perl_0.08-3_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-3) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../7-libfile-fcntllock-perl_0.22-3+b2_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-3+b2) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../8-manpages-dev_4.10-2_all.deb ...
Unpacking manpages-dev (4.10-2) ...
Setting up libdpkg-perl (1.18.25) ...
Setting up libfile-fcntllock-perl (0.22-3+b2) ...
Setting up dpkg-dev (1.18.25) ...
Processing triggers for libc-bin (2.27-6) ...
Setting up libfakeroot:amd64 (1.21-3.1) ...
Setting up libalgorithm-diff-perl (1.19.03-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up manpages-dev (4.10-2) ...
Setting up fakeroot (1.21-3.1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-4+b2) ...
Processing triggers for libc-bin (2.27-6) ...
[master 77f42a4] committing changes in /etc after apt run
13 files changed, 28 insertions(+)
create mode 120000 alternatives/faked.1.gz
create mode 120000 alternatives/faked.es.1.gz
create mode 120000 alternatives/faked.fr.1.gz
create mode 120000 alternatives/faked.sv.1.gz
create mode 120000 alternatives/fakeroot
create mode 120000 alternatives/fakeroot.1.gz
create mode 120000 alternatives/fakeroot.es.1.gz
create mode 120000 alternatives/fakeroot.fr.1.gz
create mode 120000 alternatives/fakeroot.sv.1.gz
create mode 100644 dpkg/shlibs.default
create mode 100644 dpkg/shlibs.override
create mode 100644 ld.so.conf.d/fakeroot-x86_64-linux-gnu.conf

sudo aptitude -f install build-essential
The following NEW packages will be installed:
build-essential g++{a} g++-6{a} libc-dev-bin{ab}
libc6-dev{ab} libstdc++-6-dev{a} linux-libc-dev{a}
0 packages upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.6 MB of archives. After unpacking 60.9 MB will be used.
The following packages have unmet dependencies:
libc6-dev : Depends: libc6 (= 2.24-11+deb9u4) but 2.27-6 is installed
libc-dev-bin : Depends: libc6 (< 2.25) but 2.27-6 is installed
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) build-essential [Not Installed]
2) g++ [Not Installed]
3) g++-6 [Not Installed]
4) libc-dev-bin [Not Installed]
5) libc6-dev [Not Installed]
6) libstdc++-6-dev [Not Installed]



Accept this solution? [Y/n/q/?]
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.


apt install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you haverequested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: g++ (>= 4:6.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

结果还是一样。

与此同时,我升级到了 Debian v9.12。

apt --dry-run install libc6=2.24-11+deb9u4
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  glibc-doc locales
The following packages will be REMOVED:
  libc-bin locales sudo
The following packages will be DOWNGRADED:
  libc6
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  libc-bin
0 upgraded, 0 newly installed, 1 downgraded, 3 to remove and 0 not upgraded.
Remv locales [2.27-6]
Remv libc-bin [2.27-6]
Remv sudo [1.8.23-2]
Inst libc6 [2.27-6] (2.24-11+deb9u4 Debian:9.12/oldstable [amd64])
Conf libc6 (2.24-11+deb9u4 Debian:9.12/oldstable [amd64])

我可以试试apt --dry-run install libc6=2.24-11+deb9u4吗?

如何修复未满足的依赖项?

debian
  • 5 个回答
  • 21412 Views
Martin Hope
klor
Asked: 2019-08-12 21:48:08 +0800 CST

Moodle 3.7 & Apache & 反向代理结果 ERR_TOO_MANY_REDIRECTS

  • 0

具有反向代理结果 ERR_TOO_MANY_REDIRECTS 的 Moodle 3.7 Apache。

我在前端服务器上有一个带有以下 vhosts 文件的 SSL 站点:

<VirtualHost *:80>
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>     


<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName moodle.site.com:443

SSLEngine on
SecAuditEngine On
RewriteEngine On

    ProxyPreserveHost On
    ProxyPass / http://101.102.103.104:80/
    ProxyPassReverse / http://101.102.103.104:80/

</VirtualHost>                                  
</IfModule>

我还将所有 80 个端口请求重定向到 SSL 端口。

命令

curl -I https://moodle.site.com/

结果:

HTTP/1.1 303 See Other
Date: Fri, 09 Aug 2019 19:13:33 GMT
Server: Apache/2.4.38 (Debian)
Strict-Transport-Security: max-age=15768000; includeSubDomains
Location: https://moodle.site.com
Content-Language: en
Content-Type: text/html; charset=UTF-8

在 Moodle config.php 的后端服务器上,我有:

$CFG->wwwroot   = 'https://moodle.site.com';
$CFG->reverseproxy = true;
$CFG->sslproxy  = 1;

知道为什么当我尝试打开https://moodle.site.com URL 时在 Google Chrome 中出现“ERR_TOO_MANY_REDIRECTS”错误吗?

编辑1:

101.102.103.104 是 Moodle 后端服务器的 IP 地址。前端服务器有moodle.site.com 子域名,解析为1.2.3.4。用户输入moodle.site.com URL,它应该从101.102.103.104 IP 地址反向代理来自Moodle 后端服务器的内容。

apache-2.4
  • 3 个回答
  • 3933 Views
Martin Hope
klor
Asked: 2019-03-12 11:56:18 +0800 CST

绑定错误:运行 named-checkzone 时没有当前所有者名称错误

  • -1

使用 Debian 杰西。

我尝试配置我的绑定区域,但是当我使用named-checkzone. 一个错误是“没有当前所有者名称”。

root@host:/etc# named-checkzone test /etc/bind/db.test.domain
/etc/bind/db.test.domain:2: no current owner name
/etc/bind/db.test.domain:4: no TTL specified; zone rejected
/etc/bind/db.test.domain:6: no TTL specified; zone rejected
/etc/bind/db.test.domain:7: no TTL specified; zone rejected
/etc/bind/db.test.domain:9: no TTL specified; zone rejected
/etc/bind/db.test.domain:10: no TTL specified; zone rejected
/etc/bind/db.test.domain:13: no TTL specified; zone rejected
/etc/bind/db.test.domain:14: no TTL specified; zone rejected
/etc/bind/db.test.domain:15: no TTL specified; zone rejected
/etc/bind/db.test.domain:16: no TTL specified; zone rejected
zone test/IN: loading from master file /etc/bind/db.test.domain failed: no owner
zone test/IN: not loaded due to errors.

这是 /etc/bind/db.test.domain 文件:

        IN  NS  ns

_spf        TXT "v=spf1 ip4:111.222.133.0/22 mx exists:%{1}.%{i}._spf ?all"

@       MX  50  mail.domain.com.
@       TXT "v=spf1 redirect=_spf.sub.domain.com"

mail.domain.com     A   111.222.133.144
mail.domain.com     AAAA    2000:888:8888:11::199


@       A   111.222.133.155
@       AAAA    2000:777:7777:11::199
www     A   111.222.133.155
www     AAAA    2000:777:7777:11::199

我该如何解决?

debian
  • 1 个回答
  • 1105 Views
Martin Hope
klor
Asked: 2018-08-29 13:35:02 +0800 CST

Apache 2.4 + PHP-FPM + ProxyPassMatch 使用 Unix 套接字

  • 1

我尝试使用 Unix 套接字设置 Apache v2.4 + PHP-FPM + ProxyPassMatch。

使用 Debian 9 Stretch、PHP v5.6.37、PHP v7.0.31、Apache v2.4.25。

我的虚拟主机设置如下(000-default.conf):

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName local.lc

    DocumentRoot /var/www

    ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php5.6-fpm.sock|fcgi://localhost/var/www/"

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

我执行了以下命令:

sudo apt-get install php7.0-cli php7.0-fpm php-pear libapache2-mod-fcgid
sudo apt install software-properties-common
# add repo to get PHP5
sudo apt-get -y install apt-transport-https lsb-release ca-certificates
sudo curl https://packages.sury.org/php/apt.gpg | apt-key add -
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo echo 'deb https://packages.sury.org/php/ stretch main' > /etc/apt/sources.list.d/deb.sury.org.list
sudo apt-get update
sudo apt-get install php5.6-cli php5.6-fpm
sudo apt-get install php7.0 php7.0-fpm
sudo a2enconf php5.6-fpm
sudo systemctl reload apache2
sudo a2dismod php5 php7 php5.6 php7.0 mpm_prefork
sudo a2enmod actions alias proxy_fcgi mpm_worker
sudo systemctl restart apache2 php5.6-fpm php7.0-fpm

更改后使用以下命令重新启动服务器:

sudo systemctl restart apache2 php5.6-fpm php7.0-fpm

我得到空页面,当我加载

http://local.lc/

我的基于 Windows 的开发计算机上的网站。local.lc 位于“hosts”文件中。

我在日志 (/var/log/apache2/error.log) 中看到以下内容:

[Tue Aug 28 23:24:26.685004 2018] [mpm_worker:notice] [pid 43104:tid 140487559849152] AH00295: caught SIGTERM, shutting down
[Tue Aug 28 23:24:27.001054 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity for Apache/2.9.1 (http://www.modsecurity.org/) configured.
[Tue Aug 28 23:24:27.001189 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity: APR compiled version="1.5.2"; loaded version="1.5.2"
[Tue Aug 28 23:24:27.001205 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity: PCRE compiled version="8.39 "; loaded version="8.39 2016-06-14"
[Tue Aug 28 23:24:27.001223 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity: LUA compiled version="Lua 5.1"
[Tue Aug 28 23:24:27.001236 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity: YAJL compiled version="2.1.0"
[Tue Aug 28 23:24:27.001248 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity: LIBXML compiled version="2.9.4"
[Tue Aug 28 23:24:27.001498 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity: StatusEngine call: "2.9.1,Apache/2.4.25 (Debian),1.5.2/1.5.2,8.39/8.39 2016-06-14,Lua 5.1,2.9.4,cb"
[Tue Aug 28 23:24:27.135554 2018] [:notice] [pid 43531:tid 139833116394688] ModSecurity: StatusEngine call successfully sent. For more information visit: http://status.modsecurity.org/
[Tue Aug 28 23:24:28.005175 2018] [mpm_worker:notice] [pid 43532:tid 139833116394688] AH00292: Apache/2.4.25 (Debian) OpenSSL/1.0.2l mod_fcgid/2.3.9 configured -- resuming normal operations
[Tue Aug 28 23:24:28.005270 2018] [core:notice] [pid 43532:tid 139833116394688] AH00094: Command line: '/usr/sbin/apache2'

我在日志中看不到任何帮助。

知道可能出了什么问题吗?

为什么默认页面没有加载?

apache-2.4
  • 2 个回答
  • 7087 Views
Martin Hope
klor
Asked: 2017-04-02 08:32:00 +0800 CST

rsync 错误:在 io.c(605) 处找不到远程命令(代码 127):

  • 8

我收到以下错误:

    sudo ionice -c 3 nice -n +19 rsync -av --progress -e 'ionice -c 3 nice -n +19 ssh -l root -p 22 192.168.0.1' 192.168.0.1:/domains/remote/. /domains/local/;
[email protected]'s password:
bash: 192.168.0.1: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(605) [Receiver=3.0.9]

rsync 之前工作过,现在我收到此错误。

编辑1:

root@local-debian7:/root# rsync -av --progress -e 'ssh -l root -p 22 192.168.0.1' 192.168.0.1:/domains/remote/. /domains/local/;
[email protected]'s password:
bash: 192.168.0.1: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(605) [Receiver=3.0.9]

简化后还是一样。

编辑2:

rsync -av --progress -e 'ssh -l root -p 22' 192.168.0.1:/domains/remote/. /domains/local/;

在-e部分删除第一个192.168.0.1后,终于成功了!

感谢@andrew-domaszek!

linux
  • 4 个回答
  • 30079 Views
Martin Hope
klor
Asked: 2017-04-01 08:00:21 +0800 CST

SSH 询问一次密码,重复使用密码直到超时结束

  • 3

我怎么解决这个问题?我有一个 bash 脚本(在 Ubuntu 服务器下),做几个 SSH 连接,执行一些远程传输,比如 rsync 多次。

我的问题是,我想避免多次输入密码。但我不想使用 SSH 公钥交换,因为如果有人拥有密钥,就可以连接远程计算机。

我想要以下内容:

  • SSH 应该在我启动 bash 脚本时询问密码
  • 重复使用密码,所以在超时之前不要再次询问密码
  • 超时后,再次询问密码。

类似的东西,sudo 是如何工作的,只是使用 ssh。

知道如何解决这个问题吗?

编辑1:

我发现了一个名为 ssh 多路复用的新 SSH 功能。也许使用它我可以达到我想要的目标。

https://unix.stackexchange.com/questions/50508/reusing-ssh-session-for-repeated-rsync-commands

这行得通吗?

ssh
  • 5 个回答
  • 14370 Views
Martin Hope
klor
Asked: 2017-03-31 12:00:33 +0800 CST

MySQL 查询不是从 bash 执行的,而是从 MySQL 客户端工作的

  • 0

使用 UBUNTU 16。

MySQL 查询从 bash 失败,但可以从 MySQL 客户端工作:

    query=$(cat << EOF
CREATE DATABASE \`${mysql_local_database}\` /*!40100 COLLATE \'utf8_hungarian_ci\' */; use \`${mysql_local_database}\`; GRANT SELECT, EXECUTE, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, UPDATE, LOCK TABLES  ON \`${mysql_local_database}\`.* TO 'myuser'@'%'; FLUSH PRIVILEGES;
EOF
)
echo $query
mysql -u ${mysql_local_user} -p${mysql_local_pass} -h localhost "${query}"

执行 bash 脚本后出现以下错误:

    CREATE DATABASE `mydb` /*!40100 COLLATE 'utf8_hungarian_ci' */; use `mydb`; GRANT SELECT, EXECUTE, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, UPDATE, LOCK TABLES ON `mydb`.* TO 'user'@'%'; FLUSH PRIVILEGES;
ERROR 1102 (42000): Incorrect database name 'CREATE DATABASE `mydb` /*!40100 COLLATE 'utf8_hungarian_ci' */'

如果我在 MySQL 客户端(HeidiSQL)中执行打印的 MySQL 查询,它工作正常:

CREATE DATABASE `mydb` /*!40100 COLLATE 'utf8_hungarian_ci' */; use `mydb`; GRANT SELECT, EXECUTE, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, UPDATE, LOCK TABLES ON `mydb`.* TO 'myuser'@'%'; FLUSH PRIVILEGES;

/* Affected rows: 1  Found rows: 0  Warnings: 0  Duration for 4 queries: 0,000 sec. */

请告知如何修复它。

解决方案

正如@yoonix 指出的那样,是的,缺少 -e 选项。

mysql -u ${mysql_local_user} -p${mysql_local_pass} -h localhost - e "${query}"

现在效果很好。谢谢您的帮助!

linux
  • 1 个回答
  • 1557 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