In this post we describe how to install and configure an apache server in front of zope with buildout.
It’s very simple. Ok let’s go
1 – Create an zope instance with buildout
If you have a paster in your system we create an buildout skeleton with it:
$ paster create -t plone3_buildout
This create an buildout.cfg witch create an zope server (listen in 8080)
$ python2.4 bootstrap.py $ bin/buildout
Create an instance named plone
$ bin/instance start
Ok now with your favourite browser you can see in http://localhost:8080/plone
the plone instance..
We can declare a localdns (for test purpose) that says that www.testit.com go to localhost..
So http://www.testit.com:8080/plone works also.
2 – Apache serve your plone instance
It’s possible now with buildout
We add an apache server to serve our zope in http port
Edit buildout.cfg and put this config in buildout::
[buildout] parts = ... apachebuild apacheconf ... [apachebuild] recipe = plone.recipe.apache:build url = http://mir2.ovh.net/ftp.apache.org/dist/httpd/httpd-2.2.8.tar.gz [apacheconf] recipe = plone.recipe.apache:config bind = 80 backends = www.testit.com:127.0.0.1:8080 zope2_vhm_map = www.testit.com:/plone
You have already an httpd installed in your system . No problem
delete apachebuild conf and add in apacheconf a new directive mainconfig as this
[apacheconf] mainconfig = /etc/apache2/apache2.conf recipe = plone.recipe.apache:config bind = 80 backends = www.testit.com:127.0.0.1:10080 zope2_vhm_map = www.testit.com:/plone
BE CAREFUL : the user that launch buildout must write in mainconfig so give to him the good right !! Also in order to work the current apache server must have rewrite and proxy module allowed.
So now relaunch buildout::
# bin/buildout Getting distribution for 'plone.recipe.apache'. Got plone.recipe.apache 0.1.0. ... apachebuild: Downloading apache tarball. apachebuild: Compiling Apache ... apachebuild: Unpacking and configuring checking for chosen layout... Apache ... Installing apacheconf.
And after, start (or restart) apache server
# sudo bin/apachectl start
and now::
http://www.testit.com/ go to your plone instance.. Viva buildout !
June 12, 2008 at 3:25 pm
So, if I already have a conf file that I want Apache to load located at ‘/var/zope/cp/apache/conf/apache.conf’ and I want buildout to build Apache, what do I specify in [apacheconf]?
Would it look like so?
mainconfig = /var/zope/cp/apache/conf/apache.conf
recipe = plone.recipe.apache:config
bind = 80
backends =
http://www.testit.com:127.0.0.1:10080
zope2_vhm_map =
http://www.testit.com:/plone
I tried this but didn’t see how the build links to this conf.
June 13, 2008 at 7:13 am
Hi,
I think that your config is correct !
The buildout process must write in /var/zope/cp/apache/conf/apache.conf (verify that it can write to this file)
Normaly apache recipe write to the end of this file an apache directive as this :
Include %config_dir/*.conf where %config_dir is
parts//conf.d/ relative to buildout directory (verify that)
So when you restart your apache server all conf generated by apache recipe will be loaded
Regards Youenn
July 21, 2008 at 10:15 am
Hi,
I wish to use only apacheconf (apache is already installed), and launch the buildout with an unpriviliged user “zope”.
But I don’t know to give wright rights (securely) to a file owned by root (/etc/apache2/apache2.conf)
What’s your recipe for that case?
TIA for any answer
July 24, 2008 at 10:33 am
Is it possible to use this with a multiple instances (one for dev and another for prod) ?
I would like to say:
- on port 80, show prod instance
- on port 82, show dev instance
August 1, 2008 at 8:49 am
Olivier,
You can give write right to user zope via group configuration in your system I think. You can also via plone.recipe.command give temporary access via sudo and chmod to this user with to parts : setup_right and remove_right wich decorate the configuration part.
No real good solution for that…
Regards Youenn.