| 171 | | === Set up mod_python === |
| 172 | | |
| 173 | | The information in this section was condensed from the following page: [[Configuring and testing mod_python]]. The page requires a login and probably isn't necessary. |
| 174 | | |
| 175 | | Locate the apache2 configuration file (httpd.conf or apache2.conf). In Linux, it is located in /etc/apache2/. |
| 176 | | Enable mod_python: |
| 177 | | |
| 178 | | * Windows users: add the following line to the Apache conf file: |
| 179 | | |
| 180 | | {{{ |
| 181 | | LoadModule python_module modules/mod_python.so |
| 182 | | }}} |
| 183 | | |
| 184 | | * Linux users: If you have installed Apache and mod_python from packages, adding this line should not be necessary. |
| 185 | | |
| 186 | | Windows users will need to edit/config the file httpd.conf. Linux (Ubuntu) users will need to create a file inside sites-available (and a symbolic link to it in sites-enabled) with the following content. |
| 187 | | |
| 188 | | Make sure this lines appear in the Apache configuration file: |
| 189 | | {{{ |
| 190 | | ServerName myservername.cern.ch |
| 191 | | ServerAdmin your.email@cern.ch |
| 192 | | |
| 193 | | DocumentRoot /home/jdoe/cds-indico/indico/htdocs |
| 194 | | directoryIndex index.py index.html |
| 195 | | |
| 196 | | SetEnv PYTHON_EGG_CACHE /tmp/.python-eggs |
| 197 | | }}} |
| 198 | | |
| 199 | | Add the following to make Apache re-route JSON-RPC requests to the json-rpc-handler.py file located in htdocs. Make sure this <Directory> entry appears BEFORE the <Directory> entry found below. |
| 200 | | |
| 201 | | {{{ |
| 202 | | <Directory "/home/jdoe/indico/cds-indico/indico/htdocs/services"> |
| 203 | | PythonPath "sys.path+['/home/jdoe/indico/cds-indico/indico','/home/jdoe/indico/cds-indico/indico/htdocs']" |
| 204 | | SetHandler python-program |
| 205 | | PythonHandler MaKaC.services.handler |
| 206 | | Allow from All |
| 207 | | </Directory> |
| 208 | | }}} |
| 209 | | |
| 210 | | Add the following text so that Apache will interpret all the files in htdocs as Python script files. |
| 211 | | |
| 212 | | {{{ |
| 213 | | <Directory "/home/jdoe/indico/cds-indico/indico/htdocs"> |
| 214 | | AddHandler python-program .py |
| 215 | | PythonHandler mod_python.publisher |
| 216 | | PythonDebug On |
| 217 | | PythonPath "sys.path+['/home/jdoe/indico/cds-indico/indico']" |
| 218 | | Allow from All |
| 219 | | </Directory> |
| 220 | | }}} |
| 221 | | |
| 222 | | Change the above directories to match your installation. |
| 223 | | |
| 224 | | Here's an explanation of the above lines from a non-English speaker for your amusement: |
| 225 | | |
| 226 | | * Directory: the directory whose files you want to be interpreted as python files. In Indico, it's the htdocs directory. |
| 227 | | * !AddHandler: it tells apache to interpret .py files as python files. |
| 228 | | * !PythonHander: mod_python has several handlers available. Depending of the handler, the methods of the .py files have to be different. In Indico, we use mod_python.publisher as handler. |
| 229 | | * !PythonDebg On: if there is an exception, you will see the trace in your browser. |
| 230 | | * !PythonPath: adds the rest of the Indico classes (in other directories than htdocs) toApache's python path (not the system global path!), so that the htdocs files can call files from other directories. |
| 231 | | * !PythonAutoReloadOff: I don't know! |
| 232 | | |
| 233 | | Add the following lines, in this order: |
| 234 | | {{{ |
| 235 | | Alias /indico/images "/home/jdoe/indico/cds-indico/indico/htdocs/images" |
| 236 | | Alias /indico/js "/home/jdoe/indico/cds-indico/indico/htdocs/js" |
| 237 | | Alias /indico "/home/jdoe/indico/cds-indico/indico/htdocs" |
| 238 | | }}} |
| | 171 | === Set up mod_wsgi === |
| | 172 | |
| | 173 | From the version v0.98, Indico is running with mod_wsgi and not with mod_python anymore. If you already have a previous installation of Indico with mod_python, you should first remove it before starting the mod_wsgi installation and configuration. If this is your case, you should first take a look at the following page [wiki:Admin/Installation0.98#a3.1Removingmod_python removing mod_python]. |
| | 174 | |
| | 175 | Once mod_python totally removed from your configuration you can proceed by installing mod_wsgi. The following steps will concern only the configuration in Linux, you can refer to this page to have the details about the configuration in Windows: [wiki:Admin/Installation0.98#a3.2.2.InstallationonWindows Windows config]. |
| | 176 | |
| | 177 | Let's finally focus on the installation of mod_wsgi. |
| | 178 | |
| | 179 | Create a new file in the 'sites-available' folder of apache. It's located by default under '/etc/apache2/sites-available/'. |
| | 180 | {{{ |
| | 181 | jdoe@localhost ~$ sudo gedit /etc/apache2/sites-available/indico |
| | 182 | }}} |
| | 183 | |
| | 184 | Copy the next lines into that file, making sure to replace 'jdoe' with your username: |
| | 185 | {{{ |
| | 186 | AddDefaultCharset UTF-8 |
| | 187 | <VirtualHost *:80> |
| | 188 | # mod_wsgi indico |
| | 189 | |
| | 190 | ErrorLog /var/log/apache2/error.log |
| | 191 | LogLevel warn |
| | 192 | |
| | 193 | Alias /indico/images "/home/jdoe/indico/cds-indico/indico/htdocs/images" |
| | 194 | Alias /indico/css "/home/jdoe/indico/cds-indico/indico/htdocs/css" |
| | 195 | Alias /indico/js "/home/jdoe/indico/cds-indico/indico/htdocs/js" |
| | 196 | Alias /indico/ihelp "/home/jdoe/indico/cds-indico/indico/htdocs/ihelp" |
| | 197 | |
| | 198 | WSGIDaemonProcess WSGIDAEMON processes=1 threads=1 inactivity-timeout=3600 maximum-requests=10000 \ |
| | 199 | python-eggs=/home/jdoe/indico/tmp/egg-cache |
| | 200 | |
| | 201 | WSGIScriptAlias /indico "/home/jdoe/indico/cds-indico/indico/htdocs/index.wsgi" |
| | 202 | |
| | 203 | <Directory "/home/jdoe/indico/cds-indico/indico"> |
| | 204 | WSGIProcessGroup WSGIDAEMON |
| | 205 | WSGIApplicationGroup %{GLOBAL} |
| | 206 | AllowOverride None |
| | 207 | Options None |
| | 208 | Order deny,allow |
| | 209 | Allow from all |
| | 210 | </Directory> |
| | 211 | </VirtualHost> |
| | 212 | }}} |
| | 213 | |
| | 214 | Here's the explanation of the above lines: |
| | 215 | |
| | 216 | * Alias: Redirects some static locations to the containing folders, reducing load times. |
| | 217 | * WSGIDaemonProcess: Create 5 daemon processes of 1 thread each with name WSGIDAEMON. Set the python-path and python-eggs paths. (The other two parameters are for robustness). |
| | 218 | * WSGIScriptAlias: Redirect all petitions starting with /indico to the specified file. |
| | 219 | * WSGIProcessGroup: Configure the execution with the settings of WSGIDAEMON. |
| | 220 | * WSGIApplicationGroup: Set the execution to run under the same Python interpreter (the first created). |
| | 221 | |
| | 222 | |
| | 223 | Finally, enable wsgi, the new webpage and restart apache. |
| | 224 | {{{ |
| | 225 | jdoe@localhost ~$ sudo a2enmod wsgi |
| | 226 | jdoe@localhost ~$ sudo a2ensite indico |
| | 227 | jdoe@localhost ~$ sudo apache2ctl restart |
| | 228 | }}} |
| | 229 | |
| | 230 | Accessing `http://localhost/indico/index.py` should give you the main Indico page. |
| | 231 | |
| | 232 | To have a better understanding of the WSGI interface you can refer to the following document [wiki:Dev/Technical/WSGI]. |
| | 233 | If you need more informations about the installation of v0.98, the configuration of a secured protocol and so on, please refer to [wiki:Admin/Installation0.98] |