【问题标题】:Apache subdomain for graphite using mod_wsgi and SSL使用 mod_wsgi 和 SSL 的石墨 Apache 子域
【发布时间】:2017-05-05 03:31:55
【问题描述】:

我在使用新子域配置我的 apache 时遇到问题。

它是一个带有 apache2 和石墨的 ubuntu 服务器,我有石墨在端口 80 上工作(通过 apt-get 安装)

现在 apache 服务器当前为网站 (https://subdomain1.domain.com) 提供服务,我想设置 apache 以在 https://subdomain2.domain.com(端口 443)上服务石墨应用程序。这样子域 1 就可以从石墨访问图表。

这是我的 apache2-graphite.conf

 <VirtualHost *:80>

    WSGIDaemonProcess _graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=_graphite group=_graphite
    WSGIProcessGroup _graphite
    WSGIImportScript /usr/share/graphite-web/graphite.wsgi process-group=_graphite application-group=%{GLOBAL}
    WSGIScriptAlias / /usr/share/graphite-web/graphite.wsgi

    Alias /content/ /usr/share/graphite-web/static/
    <Location "/content/">
            SetHandler None
    </Location>

    ErrorLog ${APACHE_LOG_DIR}/graphite-web_error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/graphite-web_access.log combined

</VirtualHost>

还有 /usr/share/graphite-web/graphite.wsgi :

import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

from graphite.logger import log
log.info("graphite.wsgi - pid %d - reloading search index" % os.getpid())
import graphite.metrics.search

我已尝试更改端口并设置 ServerName 和 ServerAlias,并启用 SSL,但我无法使其正常工作。

示例(不工作):

<IfModule mod_ssl.c>

<VirtualHost *:443>


        ServerName graphite.<my_domain_here>    

        WSGIDaemonProcess _graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=_graphite group=_graphite
        WSGIProcessGroup _graphite
        WSGIImportScript /usr/share/graphite-web/graphite.wsgi process-group=_graphite application-group=%{GLOBAL}
        WSGIScriptAlias / /usr/share/graphite-web/graphite.wsgi

        Alias /content/ /usr/share/graphite-web/static/
        <Location "/content/">
                SetHandler None
        </Location>

        ErrorLog ${APACHE_LOG_DIR}/graphite-web_error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/graphite-web_access.log combined


        SSLEngine on

        SSLCertificateFile    /etc/apache2/ssl/public.crt
        SSLCertificateKeyFile /etc/apache2/ssl/private.key
        SSLCACertificateFile /etc/apache2/ssl/ca.crt


</VirtualHost>

【问题讨论】:

    标签: ssl apache2 subdomain mod-wsgi graphite


    【解决方案1】:

    我发现我做错了什么:

    我将子域添加到我的工作站上的 /etc/hosts 并且它工作正常!

    向我们的虚拟主机注册子域,现在一切正常

    我把这个留在这里,以防它帮助别人......

    【讨论】:

    • ServerName 最后也不应该有:443。它只是主机名。可能只适用于你也有ServerAlias。修复ServerName 并删除ServerAlias
    • 我更新了 VirtualHost 条目,感谢 Graham
    猜你喜欢
    • 1970-01-01
    • 2019-01-09
    • 2017-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    相关资源
    最近更新 更多