【问题标题】:Netbox Management IP Address网箱管理 IP 地址
【发布时间】:2021-02-15 05:51:55
【问题描述】:

我已经在 Ubuntu 服务器上安装了 netbox。
我已经使用这个命令测试了网箱

python3 manage.py runserver 0.0.0.0:8000 --insecure

这行得通,我暂时将其作为后台任务运行。 这不是一个永久的解决方案。

我能够让服务运行,因为我可以使用它访问它

wget 127.0.0.1:8000

这是一个本地环回地址,我想知道如何将其更改为服务器的 IP 地址。 我试图更改配置中的服务器地址,但没有运气

这是 systemctl 状态的样子:

Nov 02 12:05:29 l systemd[1]: Started NetBox WSGI Service.
Nov 02 12:05:29 l gunicorn[2330166]: !!!
Nov 02 12:05:29 l gunicorn[2330166]: !!! WARNING: configuration file should have a valid Python extension.
Nov 02 12:05:29 l gunicorn[2330166]: !!!
Nov 02 12:05:29 l gunicorn[2330166]: [2020-11-02 12:05:29 +0000] [2330166] [INFO] Starting gunicorn 20.0.4
Nov 02 12:05:29 l gunicorn[2330166]: [2020-11-02 12:05:29 +0000] [2330166] [INFO] Listening at: http://127.0.0.1:8000 (2330166)
Nov 02 12:05:29 l gunicorn[2330166]: [2020-11-02 12:05:29 +0000] [2330166] [INFO] Using worker: sync
Nov 02 12:05:29 l gunicorn[2330195]: [2020-11-02 12:05:29 +0000] [2330195] [INFO] Booting worker with pid: 2330195

如果有人能指出我允许我使用服务器 IP 地址从网络访问它的正确方向?

【问题讨论】:

    标签: python django gunicorn netbox


    【解决方案1】:

    确保您已使用 pip 为 wsgi HTTP 安装 Gunicorn:

    pip3 install gunicorn
    

    netbox的systemd服务请参考官方文档

    Reference link

    使用 httpd 将 netbox 重定向到 apache 网络服务器,它将监听端口 0.0.0.0:8085。您可以使用您的 IP 访问 netbox,例如您的 IP 是 172.32.32.10 然后在浏览器中 172.32.32.10:8085

    在此之前安装 apache web 服务器yum install httpd -y 将以下配置复制到/etc/httpd/conf.d/netbox.conf

    systemctl start httpd
    systemctl enable httpd
    

    注意,netbox 的默认端口是 8001。它将被重定向到您的 apache 网络服务器。

    netbox.conf

    Listen 8085
    ProxyPreserveHost On
    ServerName netbox.example.com
    Alias /static /opt/netbox/netbox/static
       <Directory /opt/netbox/netbox/static>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Require all granted
       </Directory>
       <Location  /static>
            ProxyPass !
      </Location>
    
    ProxyPass / http://127.0.0.1:8001/
    ProxyPassReverse / http://127.0.0.1:8001/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-21
      • 1970-01-01
      • 2019-02-03
      • 2016-02-07
      • 1970-01-01
      • 2012-02-05
      • 2021-05-31
      相关资源
      最近更新 更多