【问题标题】:host ansible tower behind nginx在 nginx 后面托管 ansible 塔
【发布时间】:2017-07-03 06:13:58
【问题描述】:

官网上说要在nginx后面托管ansible tower,需要在/etc/tower/conf.d/remote_host_headers.py文件中提供headers。

但是,在我的/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 塔?

【问题讨论】:

    标签: nginx ansible-tower


    【解决方案1】:

    我不确定你为什么没有那个文件,但我有:

    这是它的内容:

    # 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

    迈克尔

    【讨论】:

    • 你能告诉我该文件中哪些行没有注释吗?
    • 你需要更改最后一行,我已经更新了我的答案。
    猜你喜欢
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-18
    • 2018-08-22
    • 2022-06-22
    • 2019-12-11
    • 1970-01-01
    相关资源
    最近更新 更多