是否可以替换通过代理传递的每个页面上的内容,类似于 mod_rewrite 用于 URL 的方式?关于替代品的文件不清楚。
我有一些我正在反向代理的页面具有绝对路径。这破坏了网站。它们需要替换,并且 mod_rewrite 之类的工具没有选择它们,因为它们不是 URL 请求。
<VirtualHost *:80>
ServerName servername1
ServerAlias servername2
ErrorLog "/var/log/proxy/jpuat_prox_error_log"
CustomLog "/var/log/proxy/jpuat_prox_access_log" common
RewriteEngine on
LogLevel alert rewrite:trace2
RewriteCond %{HTTP_HOST} /uat.site.co.jp$ [NC]
RewriteRule ^(.*)$ http://jp.uat.site2uk.co.uk/$1 [P]
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|uat.site.co.jp|jp.uat.site2uk.co.uk|i"
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://uat.site.co.jp/
ProxyPassReverse / http://uat.site.co.jp/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
以上都不适用于替换 HTML 字符串
<link href="//uat.site.co.jp/css/css.css
Run Code Online (Sandbox Code Playgroud)
和
<link href="//uat.site2uk.co.uk/css/css.css
Run Code Online (Sandbox Code Playgroud)
<VirtualHost *:80>
ServerName jp.uat.site2uk.co.uk
ServerAlias uat.site.co.jp
ErrorLog "/var/log/proxy/jpuat_prox_error_log"
CustomLog "/var/log/proxy/jpuat_prox_access_log" common
ProxyRequests Off
<Proxy …
Run Code Online (Sandbox Code Playgroud) 如果我做:
ssh -J jumphost.example.com target.example.com
Run Code Online (Sandbox Code Playgroud)
我最终立即登录到“目标”。
如果我使用这个 ssh 配置文件,使用较新的 ssh-7.3 跳转配置:
Host jump 10.1.*, targets*, *.example.com
HostName jumphost.example.com
IdentitiesOnly yes
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
我最终登录到“jumphost”而不是“target”
他们的钥匙串东西是为 mac 设计的,我在没有它的情况下进行了测试,它没有什么区别,但我想我会留下它以防万一。
我在正确配置 Apache mod_proxy.so 以便按需要工作时遇到很多麻烦......
主要思想是在网络中的本地计算机上创建一个代理,该代理将能够在 PHP 中处理客户端请求(通过 Apache 准备的代理连接的客户端)。而且,它也有能力处理 PHP 上的服务器响应。
这是两个功能,它们彼此独立。
让我介绍一下我需要实现的目标:
正如您在这里看到的,有两种方法:蓝色一种和红色一种。
对于蓝色的,我基本上连接了本地网络(家庭)上的客户端(机器 B - 手机),并将其配置为通过代理,即同一网络上的机器 A(个人计算机)。
所以我们可以说(不是 DHCP):
机器 A: 192.168.1.40 --> Apache 正在该机器上运行,并配置为侦听端口 80。
机器 B(手机): 192.168.1.75 --> 配置为通过代理,即 IP 192.168.1.75 和端口 80(基本上是机器 A)。
正确配置 Apache 后,基本上是从 httpd.conf 中删除 mod_proxy.so(主要工作程序)、mod_proxy_connect.so(SSL、allowCONNECT,...)和 mod_proxy_http.so(需要处理 HTTP 请求/响应),在我的例子中,有这样的行:
# Implements a proxy/gateway for Apache.
Include "conf/extra/httpd-proxy.conf"
# Various default settings
Include "conf/extra/httpd-default.conf"
# Secure (SSL/TLS) connections
Include "conf/extra/httpd-ssl.conf"
Run Code Online (Sandbox Code Playgroud)
这使我能够配置文件 httpd-proxy.conf 来准备正向代理或反向代理。
所以我不确定我需要的是正向代理还是反向代理。
对于转发代理,我这样做了:
<IfModule proxy_module>
<IfModule proxy_http_module>
#
# FORWARD Proxy …
Run Code Online (Sandbox Code Playgroud) 刚开始使用 Ansible,我在客户端机器上设置了一个 Asible 用户,并从 OpenSSL 创建了一组密钥。我在自己的帐户下运行 Ansible。我已经在 Ansible 配置中指定了用户和私钥文件。我希望远程命令以该用户身份运行,并且该用户 sudo 执行需要提升的命令。
/etc/ansible/ansible.cfg
private_key_file = /etc/ansible/pka/confman.crt
remote_user = confman
Run Code Online (Sandbox Code Playgroud)
诸如此类的命令在初始输入密码后不要求输入密码:
ansible all -m ping
Run Code Online (Sandbox Code Playgroud)
每次运行它们时都会提示输入密码:
ansible all -m ping -b
Enter passphrase for key '/etc/ansible/private_keys/confman.crt':
(success)
ansible all -m ping --sudo
Enter passphrase for key '/etc/ansible/private_keys/confman.crt':
(success)
ansible all -a "cat /etc/redhat-release"
Enter passphrase for key '/etc/ansible/private_keys/confman.crt':
(success)
Run Code Online (Sandbox Code Playgroud)
为什么?
有没有办法设置密码?有没有更安全的方法?我计划通过 cron 和其他自动化工具远程运行 ansible,在这些工具中不能输入密码。
作为上下文,我从来不需要在 Linux 服务器之间使用 SSH,总是在 Windows 机器上使用 putty、RoyalTS 和 mRemoteNG 等工具,所以我的 ssh 知识......很少。我想我错过了一些明显的东西。
我一直在按照官方文档一遍又一遍地在 CentOS7.2 上设置 sensu 但是我一直无法让它工作:
我似乎无法连接到 API。Uchiwa 给出了错误:
ALERT
Datacenter site1 returned:
Connection error. Is the Sensu API running?`
Run Code Online (Sandbox Code Playgroud)
我试过:curl -I http://localhost:4567/clients
...我没有得到回应。
这是/var/log/sensu/sensu-api.log http://pastebin.com/wHEHE0bH
我一直在创建一个脚本以使设置可重复。请参阅下面显示我的配置 的脚本:http : //pastebin.com/QEt5Msku 如果您在 CentOS7 上运行该脚本,它应该会重复这个问题。
问题在下面的回答中。在遵循在新 VM 上成功安装 sensu 的非官方指南之后,我比较了两个设置步骤,并在新 VM 上进行了几次构建后,一点一点地交换了步骤,我想出了用非官方指南中的一个替换 repo指向一个稍微不同的 URL 修复了我的问题(CentOS6 的 repo 但它适用于 7,它只安装了一个非当前版本 0.20.3)。
echo '[sensu]
name=sensu-main
baseurl=http://repos.sensuapp.org/yum/el/6/x86_64/
gpgcheck=0
enabled=1' > /etc/yum.repos.d/sensu.repo
Run Code Online (Sandbox Code Playgroud)