在官方页面上,据说要在nginx后面托管ansible塔,你需要在/etc/tower/conf.d/remote_host_headers.py
文件中提供标题。
但是,在我的/etc/tower/
文件夹中,没有conf.d/remote_host_headers.py
文件。
awx@server:/etc/tower$ tree
.
├── conf.d
│ ├── caching.py
│ ├── celeryd.py
│ ├── ha.py
│ ├── postgres.py
│ └── rabbitmq.py
├── SECRET_KEY
├── settings.py
├── settings.py.20170629122404
├── tower.cert
└── tower.key
如何通过nginx托管ansible塔?
答案 0 :(得分:0)
我不确定你为什么没有这个档案,但我确实:
这是它的内容:
# HTTP headers and meta keys to search to determine remote host name or IP. Add
# additional items to this list, such as "HTTP_X_FORWARDED_FOR", if behind a
# reverse proxy.
# Note: The headers will be searched in order and the first found remote host
# name or IP will be used.
#
# In the below example 8.8.8.7 would be the chosen IP address.
# X-Forwarded-For: 8.8.8.7, 192.168.2.1, 127.0.0.1
# Host: 127.0.0.1
# REMOTE_HOST_HEADERS = ['HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR', 'REMOTE_HOST']
# This setting is now configured via the Tower API.
# REMOTE_HOST_HEADERS = ['REMOTE_ADDR', 'REMOTE_HOST']
REMOTE_HOST_HEADERS = ['HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR', 'REMOTE_HOST']
最后一行是您想要的,特别是' HTTP_X_FORWARDED_FOR' - 它告诉Tower在反向代理之外使用了什么IP地址,因为Tower使用IP地址进行会话关联。
文档为here。
迈克尔