Nginx 如何更改Puppet企业web接口端口以避免与现有Apache web服务器冲突
我当前的CentOS 7服务器已经在运行Apache web server 2.4x,使用默认端口80和443。Puppet Enterprise版本2019.x使用nginx(确切地说是pe nginx),默认情况下配置为使用完全相同的端口 要使pe nginx web服务器使用端口8090和444而不是默认的80和443,需要进行哪些更改 根据:我应该禁用HTTPS重定向。以下是我尝试过的说明: 默认情况下,pe nginx Web服务器侦听端口80。如果需要在端口80上运行自己的服务,可以禁用HTTPS重定向Nginx 如何更改Puppet企业web接口端口以避免与现有Apache web服务器冲突,nginx,puppet,puppet-enterprise,Nginx,Puppet,Puppet Enterprise,我当前的CentOS 7服务器已经在运行Apache web server 2.4x,使用默认端口80和443。Puppet Enterprise版本2019.x使用nginx(确切地说是pe nginx),默认情况下配置为使用完全相同的端口 要使pe nginx web服务器使用端口8090和444而不是默认的80和443,需要进行哪些更改 根据:我应该禁用HTTPS重定向。以下是我尝试过的说明: 默认情况下,pe nginx Web服务器侦听端口80。如果需要在端口80上运行自己的服务,可以
puppet_enterprise::profile::console::proxy::http_redirect::enable_http_redirect: false
编辑Hiera.yaml文件以禁用HTTP重定向
puppet_enterprise::profile::console::proxy::http_redirect::enable_http_redirect: false
这是修改后的文件:/etc/puppetlabs/code/environments/production/hiera.yaml
---
version: 5
defaults:
# The default value for "datadir" is "data" under the same directory as the hiera.yaml
# file (this file)
# When specifying a datadir, make sure the directory exists.
# See https://puppet.com/docs/puppet/latest/environments_about.html for further details on environments.
# datadir: data
# data_hash: yaml_data
hierarchy:
- name: "Per-node data (yaml version)"
path: "nodes/%{::trusted.certname}.yaml"
- name: "Other YAML hierarchy levels"
paths:
- "common.yaml"
puppet_enterprise::profile::console::proxy::http_redirect::enable_http_redirect: false
我是yaml的新手,但我知道这可能不对,但我还是尝试过
它没有说明更改文件后如何实现更改,这是我尝试的:
puppet infrastructure configure --recover
Notice: Unable to recover PE configuration: The Lookup Configuration at '/etc/puppetlabs/code/environments/production/hiera.yaml' has wrong type, unrecognized key 'puppet_enterprise::profile::console::proxy::http_redirect::enable_http_redirect'
2019-05-07T15:41:29.722+00:00 - [Notice]: Compiled catalog for tadm10-adm.test.hfgs.net in environment enterprise in 2.08 seconds
2019-05-07T15:41:42.489+00:00 - [Notice]: Applied catalog in 12.05 seconds
虽然我从来没有想过如何使用Puppet Labs修改hiera.yaml文件来实现这一点,但我已经知道了如何使用Web控制台来实现这一点 这些修改消除了与使用端口80和443的现有Apache httpd的所有冲突 现在需要通过端口444访问PE Web控制台
https://hostname:444/#/inspect/overview
这是修复方法:
从Web控制台
Duplicate declaration: Class[Puppet_enterprise::Profile::Console::Proxy::Http_redirect] is already declared;
cannot redeclare (file: /opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/profile/console/proxy.pp,
line: 211)
从proxy.pp中删除重复声明
编辑:/opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/profile/console/proxy.pp
#class { 'puppet_enterprise::profile::console::proxy::http_redirect' :
# ssl_listen_port => Integer($ssl_listen_port),
#}
重新运行puppet代理-t
puppet agent -t
控制台端口(端口443更改)
从Web控制台
# puppet agent -t
# netstat -tulpn | grep -v tcp6|grep ":443\|:80\|:8090\|:444"
tcp 0 0 0.0.0.0:444 0.0.0.0:* LISTEN 11182/nginx: master
启动httpd
# systemctl start httpd
# netstat -tulpn | grep -v tcp6|grep ":443\|:80\|:8090\|:444"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13353/httpd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 13353/httpd
tcp 0 0 0.0.0.0:444 0.0.0.0:* LISTEN 11182/nginx: master
现在通过端口444访问PE Wen控制台
https://hostname:444/#/inspect/overview
我不熟悉配置PE版本,但您肯定修改了错误的文件。请注意,您已经更改了文档的含义,方法是剥离原始文档中区分“Hiera”和“
.yaml
”的格式,将其作为要修改的文件的单独描述,而不是文件名。您所修改的是Puppet的“Hiera”子系统的配置文件。您要修改的是一个关联的数据文件,它通常位于更深的一个目录中。文档建议使用hieradata/
子目录,但配置文件本身似乎指示data/
。此外,在PE安装中可能有意义,但在我看来,配置应该在每个环境的数据文件中似乎很奇怪。Hiera也支持全球数据,我猜这就是记录这些细节的地方。谢谢John的洞察力。我相信hiera.yaml的位置是正确的,所以我们检查了该位置的数据目录,它当前是空的。虽然我很想知道怎么做,但我有个好消息。我正在使用Web控制台记录此问题的答案。您可以将这两个设置添加到PE控制台组的数据部分,保存,然后开始傀儡运行。