代码之家  ›  专栏  ›  技术社区  ›  Loren Cahlander

如何在Mac OS X Mountain Lion Server中设置web代理服务?

  •  3
  • Loren Cahlander  · 技术社区  · 14 年前

    我正试图利用Mac OS X Server中的配置文件,而不是直接修改Apache的站点文件,为eXist XML数据库添加反向代理条目。映射应来自[http://example.com/exist]至[http://localhost:8080/exist]。

    eXist已启动并运行。

    我添加了以下plist文件/Library/Server/Web/Config/apache2/webapps/org.exist-db.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    
    <!-- See man pages for webapp.plist(5) and webappctl(8) for information about this example webapp.plist -->
    
    <plist version="1.0">
         <dict>
             <key>includeFiles</key>
             <array>
                 <!-- Include files are activated in virtual host when webapp is started -->
             </array>
             <key>launchKeys</key>
             <array>
                 <!-- Launchd plists in /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons are loaded when webapp is started -->
             </array>
             <key>name</key>
             <string>org.exist-db</string>
             <key>displayName</key>
             <!-- Name shown in Server app -->
             <string>eXist Open Source XML Database</string>
             <key>proxies</key>
             <!-- ProxyPass/ProxyPassReverse directives are activated when webapp is started --> 
             <dict>
                 <key>/exist</key>
                 <!-- Sets up a reverse proxy -->
                 <dict>
                     <key>keysAndValues</key>
                     <string/>
                     <key>path</key>
                     <string>/exist</string>
                     <key>urls</key>
                     <!-- URLs comprise a proxy_balancer group -->
                     <array>
                         <string>http://localhost:8080/exist</string>
                     </array>
                 </dict>
             </dict>
             <key>requiredModuleNames</key>
             <array>
                 <!-- Apache plugin modules are enabled when webapp is started -->
                 <string>proxy_module</string>
             </array>
             <key>requiredWebAppNames</key>
             <array>
                 <!-- Required web apps are started when this webapp is started -->
             </array>
             <key>installationIndicatorFilePath</key>
             <!-- The presence of this file indicates web app is installed -->
             <string>/Users/cahlander/eXist-trunk</string>
             <key>sslPolicy</key>
             <!-- Determines webapp SSL behavior -->
             <integer>0</integer>
             <!-- 0: default, UseSSLWhenEnabled -->
             <!-- 1:          UseSSLAlways -->
             <!-- 2:          UseSSLOnlyWhenCertificateIsTrustable -->
             <!-- 3:          UseSSLNever -->
             <!-- 4:          UseSSLAndNonSSL -->
         </dict>
    </plist>
    

    在本地服务器上运行,转到 http://example.com:8080/exist 工作,但来自不同的机器,去 http://example.com/exist 没有。此外,“eXist开放源代码XML数据库”应该在高级设置中显示为web应用程序。事实并非如此。我做错了什么?

    1 回复  |  直到 14 年前
        1
  •  0
  •   Loren Cahlander    14 年前

    我已经解决了所有悬而未决的问题,但遇到了新的问题。

    仅将以下内容作为org.exist-db.plist添加到/Library/Server/Web/Config/apache2/webapps

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    
    <!-- See man pages for webapp.plist(5) and webappctl(8) for information about this example webapp.plist -->
    
    <plist version="1.0">
        <dict>
            <key>includeFiles</key>
            <array/>
            <key>launchKeys</key>
            <array/>
            <key>name</key>
            <string>org.exist-db</string>
            <key>displayName</key>
            <!-- Name shown in Server app -->
            <string>eXist Open Source XML Database</string>
            <key>proxies</key>
            <!-- ProxyPass/ProxyPassReverse directives are activated when webapp is started -->
            <dict>
                <key>/exist</key>
                <!-- Sets up a reverse proxy -->
                <dict>
                    <key>keysAndValues</key>
                    <string/>
                    <key>path</key>
                    <string>/exist</string>
                    <key>urls</key>
                    <!-- URLs comprise a proxy_balancer group -->
                    <array>
                        <string>http://localhost:8080/exist</string>
                    </array>
                </dict>
            </dict>
            <key>requiredModuleNames</key>
            <array>
                <!-- Apache plugin modules are enabled when webapp is started -->
                <string>proxy_module</string>
            </array>
            <key>requiredWebAppNames</key>
            <array>
                <!-- Required web apps are started when this webapp is started -->
            </array>
            <key>startCommand</key>
            <string>/Users/cahlander/eXist-trunk/tools/wrapper/bin/exist.sh start</string>
            <key>stopCommand</key>
            <string>/Users/cahlander/eXist-trunk/tools/wrapper/bin/exist.sh stop</string>
            <key>installationIndicatorFilePath</key>
            <!-- The presence of this file indicates web app is installed -->
            <string>/Users/cahlander/eXist-trunk/VERSION.txt</string>
            <key>sslPolicy</key>
            <!-- Determines webapp SSL behavior -->
            <integer>0</integer>
            <!-- 0: default, UseSSLWhenEnabled -->
            <!-- 1: UseSSLAlways -->
            <!-- 2: UseSSLOnlyWhenCertificateIsTrustable -->
            <!-- 3: UseSSLNever -->
            <!-- 4: UseSSLAndNonSSL -->
        </dict>
    </plist>
    

    它开始了,但没有停止。该条目确实显示在高级设置中。它不会从GUI停止。

    以下命令行条目将起作用,但在我停止并重新启动后,确实出现了损坏。

    sudo-webappctl启动org.exist-db

    sudo-webappctl停止org.exist-db