How to correctly set Documentroot in Apache serving Plone

时光毁灭记忆、已成空白 提交于 2019-12-24 03:18:50

问题


I have a Plone site called example.com located at /var/www/Plone (I think). I have the following settings for the site located in sites-available for vhosts (excerpt):

<VirtualHost 10.0.1.4:8082>
    ServerAdmin webmaster@localhost
        ServerName wiedhas.noip.me
    DocumentRoot /var/www/Plone

When I try to reach my site wiedhas.noip.me, apache loads the Plone directory tree and not my Plone site. I can browse through the file system of /var/www/Plone but it is not loading the site. I must not have set the documentroot to the correct directory of my site? Any help much appreciated.


回答1:


This an excellent docu about running plone behind apache and more. http://docs.plone.org/manage/deploying/front-end/apache.html

A simple example with ssl, how a vhost could look like:

<VirtualHost $IP:80>

        ServerName my.domain.com

        Redirect / https://my.domain.com

</VirtualHost>

<VirtualHost $IP:443>

        ServerName my.domain.com

        ErrorLog logs/my.domain.com-http-error.log
        CustomLog logs/my.domain.com-http-access.log combined

        Include vhosts.d/....ssl.inc

        RewriteEngine On

        RewriteRule ^/(.*) http://127.0.0.1:$PORT_OF_PLONE/VirtualHostBase/https/%{SERVER_NAME}:%{SERVER_PORT}/zodb/path/top/plone/VirtualHostRoot/$1 [P,L]

</VirtualHost>

The most important part is the rewrite rule:

        RewriteRule ^/(.*) http://127.0.0.1:$PORT_OF_PLONE/VirtualHostBase/https/%{SERVER_NAME}:%{SERVER_PORT}/zodb/path/top/plone/VirtualHostRoot/$1 [P,L]

$PORT_OF_PLONE = Port of your running plone instance

/zodb/path/top/plone = That's where you added the plone site in zope.




回答2:


Took me a while to get mine going so maybe this helps:

My vhosts looks like this (where my plone site is called 'mywebsite'):

#---------------------------------
#     www.mywebsite.com
#---------------------------------
<VirtualHost *:80>
        ServerName      www.mywebsite.com
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteRule ^/(.*)$ http://127.0.0.1:8081/VirtualHostBase/http/%{SERVER_NAME}:80/mywebsite/VirtualHostRoot/$1 [L,P]
        </IfModule>
</VirtualHost>

Hope that helps :)




回答3:


As you see in the first and correct answer you do not need DocumentRoot. DocumentRoot points to a directory with files to render by Apache. But Plone brings it's own server, the Zope application server, which runs on a different port than Apache. The RewriteRule redirects the incoming request to the application server and modifies the response in a way that the redirection is hidden for the client.



来源:https://stackoverflow.com/questions/24443271/how-to-correctly-set-documentroot-in-apache-serving-plone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!