# Apache22 + mod_wsgi + Python 3.2 (help me configure it)



## valsorym (Sep 2, 2011)

Hello everyone.
I want to set up a local web-server: Apache 22 + mod_wsgi + Python 3.2

I install: 
www/apache22
lang/python32
www/mod_wsgi

Add in /etc/rc.conf:

```
apache22_enable="YES"
apache22_http_accept_enable="YES"
```

Add in /boot/loader.conf:

```
accf_http_load="YES"
```


```
# kldload accf_http
# rehash
```

And configure it:
1. In /usr/local/etc/apache22/httpd.conf
1.1. I comment on:

```
...
# LoadModule unique_id_module libexec/apache22/mod_unique_id.so
...
```
1.2. Check availability:

```
...
LoadModule wsgi_module libexec/apache22/mod_wsgi.so
...
```
1.3. Load my config (add in end file):

```
...
NameVirtualHost 127.0.0.1:80
Include /usr/local/www/siboo/siboo.conf
```

2. I create all project:

```
# mkdir -p /usr/local/www/siboo/
# cd /usr/local/www/siboo/
# cat siboo.conf
<VirtualHost siboo:80>
    ServerName siboo
    DocumentRoot "/usr/local/www/siboo"
    DirectoryIndex index.html index.htm
    WSGIScriptAlias / /usr/local/www/siboo/application.wsgi
	
    <Directory /usr/local/www/siboo>
        Options All
        Options MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>	
	
    ErrorLog /usr/local/www/siboo/error.log
    CustomLog /usr/local/www/siboo/access.log common
</VirtualHost>
```

And 

```
# cat application.wsgi
import sys

def app(environ, start_response):
    " ... "
    message = "You use Python %s version." % sys.version[:3]
    start_response("200 OK", [("Content-Type", "text/html")])
    return [message]

application = app
```
3. Write in /etc/hosts

```
...
127.0.0.1    siboo siboo.my.domain
```

4. Restart web-server:

```
# /usr/local/etc/rc.d/apache22 restart
# w3m siboo
```
Result:


================================================================================================
You use Python 2.7 version.
================================================================================================


I guess that is installed incorrectly mod_wsgi.
I remove mod_wsgi. And write in /etc/make.conf

```
...
PYTHON_VERSION=3.2.1
PYTHON_DEFAULT_VERSION=3.2.1
```
or

```
...
#PYTHON_VERSION=3.2.1
PYTHON_DEFAULT_VERSION=3.2
```
and or 

```
...
#PYTHON_VERSION=3.2.1
PYTHON_DEFAULT_VERSION=python3.2
```
I found the exact version running Python:

```
# python3.2
Python 3.2.1 (defult, Sep 2 2011, 18:43:12)
...
```


```
# rehash
```
And install www/mod_wsgi again.
But I have many ERROR!


----------



## ericmacmini (Sep 3, 2011)

Try to install higher version of mod_wsgi:


```
# cd /usr/ports/www/mod_wsgi3
# make
# make install
```


----------



## valsorym (Sep 3, 2011)

Yes..
A little reading, I realized that I needed to mod_wsgi 3
It's here: www/mod_wsgi3
I remove the old mod_wsgi.


```
# cd /usr/ports/www/mod_wsgi3
# make && make install clean

===>  Building for ap22-mod_wsgi-3.3_2
/usr/local/sbin/apxs -c -I/usr/local/include/python3.2mu -DNDEBUG -D__wchar_t=wchar_t -
DTHREAD_STACK_SIZE=0x20000 -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -Wc,-O2 -Wc,-pipe -Wc,-fno-
strict-aliasing mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python3.2/config -lpython3.2 -lutil -lm

/usr/local/share/apr/build-1/libtool --silent --mode=compile cc -prefer-pic -O2 -pipe -I/usr/include -
fno-strict-aliasing   -g -I/usr/local/include -I/usr/local/include/apache22  -I/usr/local/include/
apr-1   -I/usr/local/include/apr-1 -I/usr/local/include -I/usr/local/include/db42 -O2 -pipe -fno-strict-
aliasing -I/usr/local/include/python3.2mu -DNDEBUG -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -
D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo

mod_wsgi.c: In function 'Adapter_environ':
mod_wsgi.c:3601: warning: assignment makes pointer from integer without a cast
mod_wsgi.c: In function 'Dispatch_environ':
mod_wsgi.c:8372: warning: assignment makes pointer from integer without a cast
mod_wsgi.c: In function 'Auth_environ':
mod_wsgi.c:13375: warning: assignment makes pointer from integer without a cast
/usr/local/share/apr/build-1/libtool --silent --mode=link cc -o mod_wsgi.la  -rpath /usr/local/libexec/
apache22 -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.2/config 
-lpython3.2 -lutil -lm
/usr/bin/ld: cannot find -lpython3.2
apxs:Error: Command failed with rc=65536
.
*** Error code 1
*** Error code 1

Stop in /usr/ports/www/mod_wsgi3.
```

What is -lpython3.2?
Where and how can I get it?


----------



## ericmacmini (Sep 3, 2011)

I'm not sure, because i haven't this setup myself. I think that -lpython3.2 is library on which mod_wsgi3 relies. It seems that the directory reference is not correct.
I found the following post on the internet, maybe it helps you: http://ubuntuforums.org/showthread.php?t=1702377


----------



## valsorym (Sep 3, 2011)

Thank you ericmacmini.
I read this forum now. 
But the author compiles mod_wsgi3. 
I do that I will try to install it from ports. 
In extreme cases I resort to the compilation.
Thank you.


----------



## ericmacmini (Sep 3, 2011)

I installed python3.2 and the location /usr/local/lib/python3.2/config is linked to the object file -> /usr/local/lib/libpython3.2mu.so. Maybe you could try to link /usr/local/lib/python3.2/config 
-lpython3.2 to the same object file. 

Good luck.


----------



## valsorym (Sep 3, 2011)

Okay. I reinstalled FreeBSD 8.2 from scratch.
On a clean FreeBSD 8.2, I updated the ports collection.
I install:
www/apache22
lang/python32
www/mod_wsgi3

in the same manner.
mod_wsgi3 - established without problems.


_Maybe I'm not truly deleted mod_wsgi in past cases. I did it then as follows:_

```
# cd /usr/ports/www/mod_wsgi
# make && make deinstall clean
```


But this time everything was installed.
Made the setting as described in first post.
But not edit the file /etc/make.conf

Run:

```
# /usr/local/etc/rc.d/apache22 restart
# w3m siboo
```
Result:
================================================================================================
You use Python 2.7 version.
================================================================================================
again .... 

Now try to change settings /etc/make.conf


----------



## valsorym (Sep 3, 2011)

Ok, I rewrite /etc/make.conf many time, use combination:
PYTHON_VERSION=3.2.1 or PYTHON_VERSION=3.2 or PYTHON_VERSION=python3.2.1 or PYTHON_DEFAULT_VERSION=3.2.1 or PYTHON_DEFAULT_VERSION=3.2 or PYTHON_DEFAULT_VERSION=python3.2

After each last  combination I use:

```
# rehash
# /usr/local/etc/rc.d/apache22 restart
# w3m siboo
```

And again, again, again, again, again I see You use Python 2.7 version.

I also constantly edited application.wsgi - to be sure that this endorsement does not in the buffer.

How to Make python3.2 the default Apache22?


----------



## ericmacmini (Sep 3, 2011)

Try following:


```
# cd /usr/ports/www/mod_wsgi3/work/mod_wsgi-3.3
# sudo ee Makefile
```

Change the line LDLIBS =  -lpython3.2 -lutil -lm in LDLIBS =  -lpython3.2mu -lutil -lm
and reinstall the mod_wsgi3 port.

If not tested this with apache, but I was able to compile the object file.


----------



## valsorym (Sep 3, 2011)

After I rewrite /etc/make.conf (I added)

```
...
PYTHON_DEFAULT_VERSION=python3.2
```

I try reinstall mod_wsgi3

```
# cd /usr/ports/www/mod_wsgi3
# make && make reinstall clean
```
Oh, Error again:

```
...
mod_wsgi.c: In function 'Auth_environ':
mod_wsgi.c:13375: warning: assignment makes pointer from integer without a cast
/usr/local/share/apr/build-1/libtool --silent --mode=link cc -o mod_wsgi.la  -rpath /usr/local/libexec/
apache22 -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.2/config 
-lpython3.2 -lutil -lm
/usr/bin/ld: cannot find -lpython3.2
apxs:Error: Command failed with rc=65536
.
*** Error code 1
*** Error code 1

Stop in /usr/ports/www/mod_wsgi3.
```
I rewrite /etc/make.conf  again, and comment last line:

```
# PYTHON_DEFAULT_VERSION=python3.2
```

Again:

```
# cd /usr/ports/www/mod_wsgi3
# make && make reinstall clean
```

Oh.. Error. Error again. 

I use console, and: dvtm, vim-lite, w3m tools. 
First I install this tools, after I install Apache22 Python32 and mod_wsgi3,
But system already have a python27.

Now I reinstall my FreeBSD, and first I Install Apache22 Python32 and mod_wsgi3. 
After, -  other tools.


----------



## valsorym (Sep 3, 2011)

Ok, thank you ericmacmini.
I'll take your advice after the installation of the system. (about 1 hour).

Are You using Python3 on your Web-server?
Are You using Apache + mod_wsgi? or nginx + uWSGI (mod_wsgi)? or Other?

I recently switched from Windows XP to UNIX systems (FreeBSD) so Sorry for stupid questions.


----------



## valsorym (Sep 3, 2011)

After reinstalling the system (with a new order) - the same result.
Sorry, but I do not have /usr/ports/www/mod_wsgi3/work/mod_wsgi-3.3 this folder.
I have:

```
/usr/ports/www/mod_wsgi3/
                       |__ Makefile
                       |__ disrinfo
                       |__ files/
                       |        |__ pkg-message.in
                       |__ pkg-descr
                       |__ pkg_plist
                       |__ ..
                       |__ .
```

And all.
I must create this file yourself?

How critical is when I resort to compile?
If I do not use ports and download sources and compile them mod_wsgi3.
I need to put what the compiler? (probably gcc).


----------



## valsorym (Sep 3, 2011)

At least tell me how to correctly compile mod_wsgi3.
I install bin/wget


```
# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
# tar -xwzf mod_wsgi-3.3.tar.gz
# cd mod_wsgi-3.3
```
I read README and:

```
# ./configure
```

Now created Makefile.

```
# vim Makefile
```
and rewrite python2.7 on python3.2 (or python3.2mu in LDLIBS =)
Save it, and


```
# make install
```
But It do not installed.


----------



## ericmacmini (Sep 3, 2011)

Be sure to update the port collection found, excellent documentation can be found on both website and forum.
I use:

```
# sudo /usr/sbin/portsnap fetch update
# sudo /usr/sbin/pkg_version -IvL '='
```
Now, you can use the portupgrade nameofyourport command to upgrade installed ports, if necessary. 


```
# cd /usr/ports/www/mod_wsgi3
# make fetch
```

make fetch will retrieve the latest files, but be sure to run portsnap first. After editing the Makefile you can compile the port with the make command.


----------



## valsorym (Sep 3, 2011)

O, I understand.

First

```
# sudo /usr/sbin/portsnap fetch update
# sudo /usr/sbin/pkg_version -IvL '='
```

I go to

```
# cd /usr/ports/www/mod_wsgi3
# make
```
And now create work folder. 
(_Before I run: make && make install clean , and after install mod_wsgi - "work" directory was deleted_).

Ok, now I go to

```
# cd /usr/ports/www/mod_wsgi3/work/mod_wsgi-3.3
# vim Makefile
```
rewrite:

```
...
PYTHON = /usr/local/bin/python3.2
...
CPPFLAGS = -I/usr/local/include/python3.2mu -D__wchar_t= ....
...
 LDLIBS = -lpython3.2mu -lutil -lm
...
```

Save it, and 

```
# cd ../../
# pwd
pwd: /usr/ports/www/mod_wsgi3
# make install
```
- Ok, install ok.. no problem..


```
# rehash
# /usr/local/etc/rc.d/apache22 restart
# w3m siboo
```

Python 2.7, again... - why?


----------



## wblock@ (Sep 3, 2011)

Don't modify the application source, but the port.
/usr/ports/www/mod_wsgi3/Makefile

```
USE_PYTHON=     3.2+
```

The port _should_ handle substituting the appropriate links and flags when building.

Okay, you may have to modify the application source also.  Before you try to install this, make sure python-3.2 is installed.  Might be necessary to remove other versions, if nothing depends on them and prevents their removal.

Don't be surprised if it fails, but also be cautious if it seems to work.  There could be subtle problems that take a while to be visible.


----------



## ericmacmini (Sep 4, 2011)

I forgot to ask, but are you sure that apache loads the right module?
You you give this piece of code from the conf file?


----------



## valsorym (Sep 4, 2011)

Hi,


> Originally Posted by *wblock*.
> Don't modify the application source, but the port.
> /usr/ports/www/mod_wsgi3/Makefile
> 
> ...



Ok, 

```
# cd /usr/ports/www/mod_wsgi3
# make deinstall
... Ok
# rm -Rf work
# vim Makefile
```
- And edit USE_PYTHON=     3.2+

```
# make 
...
mod_wsgi.c: In function 'Auth_environ':
mod_wsgi.c:13375: warning: assignment makes pointer from integer without a cast
/usr/local/share/apr/build-1/libtool --silent --mode=link cc -o mod_wsgi.la  -rpath /usr/local/libexec/
apache22 -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.2/config 
-lpython3.2 -lutil -lm
/usr/bin/ld: cannot find -lpython3.2
apxs:Error: Command failed with rc=65536
.
*** Error code 1
*** Error code 1

Stop in /usr/ports/www/mod_wsgi3.
```

Bad,

```
# rm -Rf work
# vim Makefile
```
- And edit USE_PYTHON=     2.5+

```
# make 
.... Ok.
```
Can not install mod_wsgi use this flag USE_PYTHON= 3.2.



> Originally Posted by *wblock*.
> Okay, you may have to modify the application source also. Before you try to install this, make sure python-3.2 is installed. Might be necessary to remove other versions, if nothing depends on them and prevents their removal.


Python 3.2 installed!

```
# python3.2
Python 3.2.1 (default, Sep 3 2011, 15:48:44)
...
>>> print('Hello World.')
Hello World.
>>>
```

All that I use:
sysutils/dvtm
editors/vim-lite
japanese/w3m

And for web-server:
www/apache22
lang/python32
www/mod_wsgi3

I do not use GUI and many software.
When was the vim-lite was installed according to python2.7.
I could not remove python2.7.



> Originally Posted by *wblock*.
> Don't be surprised if it fails, but also be cautious if it seems to work. There could be subtle problems that take a while to be visible.



Thank you.
I know that python3.x not yet stable. But I've used in Windows XP (Apache2 + mod_wsgi + Python 3.1 in Windows Xp six months ago).
Also, I do not worry if this does not happen.
I can always try FastCGI or nginx + uWSGI or others



> Originally Posted by *ericmacmini*.
> I forgot to ask, but are you sure that apache loads the right module?



Yes, of course. All modules are compiled here:

```
/usr/local/libexec/apache22/mod_wsgi.so
/usr/local/libexec/apache22/mod_wsgi.la
/usr/local/libexec/apache22/mod_wsgi.a
```

I load:

```
...
LoadModule wsgi_module libexec/apache22/mod_wsgi.so
...
```
I always check that should have been loaded the correct module.


```
Originally Posted by [B]ericmacmini[/B].
You you give this piece of code from the conf file?
```
I do not quite understand what was going on.
I have difficulties with the translation.
Sorry me.


----------



## valsorym (Sep 4, 2011)

The solution is.
Not that I wanted but I satisfactory by 90%.


```
# cd /usr/ports/lang/python31
# make && make install clean
#
# mkdir -p ~/temp && cd ~/temp
# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
# tar -xf mod_wsgi-3.3.tar.gz
# cd mod_wsgi-3.3
#
# ./configure --with-python=python3.1 --disable-framework
# make install
```

Add in /usr/local/etc/apache22/httpd.conf

```
LoadModule wsgi_module libexec/apache22/mod_wsgi.so
```


```
# rehash
# /usr/local/etc/rc.d/apache22 restart
# w3m siboo
# >> You use Python 3.1 version.
```

_You use Python 3.1 version._ - Okay.


But this method of installation I was not happy. _I remove all wsgi._


```
# cd /usr/ports/www/mod_wsgi3
# rm -Rf work
# vim Makefile
```
And rewrite USE_PYTHON= 2.5+ on USE_PYTHON= 3.1 (do not USE_PYTHON= 3.1+ - otherwise it will attempt to install python3.2 and again will not be found -lpython3.2)
Save it.

```
# make
...Ok
# make install
#
# rehash
# /usr/local/etc/rc.d/apache22 restart
# w3m siboo
# >> You use Python 3.1 version.
```

Now I am satisfied by 93%.
I think that the problem in the old mod_wsgi3, which still maintains python3.1 but does not support  python3.2.
So what does all this for the library -lpython3.2?

The theme can be put on pause.
Who knows how to put python3.2 - write, will be happy.

Thank you so much user ericmacmini and  user wblock that have not thrown in a difficult moment.


----------



## nORKy (Sep 5, 2011)

I don't use python3 (I'm with python 2.7). I don't have problem with ports building, bug I can give you my apache configuration :
in a virtualhost config :

```
WSGIDaemonProcess myuser user=myuser group=users threads=25 processes=1
WSGIProcessGroup myuser
WSGIScriptAlias / /u/user/sites/www/wsgi_handler.py
```

It's a fastcgi process and works with a django framework website.


----------



## valsorym (Sep 5, 2011)

> Originally Posted by *nORKy*.
> I don't use python3 (I'm with python 2.7). I don't have problem with ports building, bug I can give you my apache configuration :
> in a virtualhost config :



In fact, there are no problems installing Py-2.7 + mod_wsgi.
And there are no problems installing Py-3.1 + mod_wsgi3.
The main problem installing Py-3.2 + mod_wsgi3. Exactly in Python 3.2 Director / usr/local/lib/python3.2/config - "not standard".
At this time in Python 2.7 and 3.1 all good.

I tried to edit / usr/local/lib/python3.2/config.
To do this, I read an article (on the recommendation of user ericmacmini) http://ubuntuforums.org/showthread.php?t=1702377.
I did everything as they have written. Everything turned out .. but as the author and I could not run mod_wsgi.so

The problem is not in the proper setting my.conf. The problem is that I can not bind (establish) mod_wsgi3 + Python 3.2.
But thanks, that took part in the discussion.


----------



## npgm (Aug 26, 2013)

Hi, ya.

For anyone else who stumbles across this page, in hopes of using mod_wsgi3 with Python 3.x.

If you check out this StackOverflow link, then you'll see that, supposedly, you just need to edit -lpython3.3 to -lpython3.3m in the Makefile.

If you check out the Google Group, it looks like this might be a bug.

Anyway, I haven't actually tried this because I'm not sure how to edit that line in the Makefile 

Here's what I did.

`cd /usr/ports/www/mod_wsgi3`
`vi Makefile`

Then I changed --with-python="${PYTHON_CMD}" to --with-python="/usr/local/bin/python3.3". However, this still causes the error mentioned above. I'm guessing I have to modify mod_wsgi3/work/mod_wsgi-3.4/Makefile, but I'm not sure what to do next. I tried a `make install` in that folder and stuff happened. No errors. But, when I checked `pkg info | grep mod`, I didn't see mod_wsgi, which makes me think I didn't install it.

Does anyone with a better understanding of unix/FreeBSD know how to continue installing mod_wsgi? Did `make install` install it on my system? Why wasn't it at `pkg info`?


----------



## npgm (Aug 26, 2013)

Okay, here's how I got it to work after all.


```
cd /usr/ports/www/mod_wsgi3
vi Makefile
Change --with-python="${PYTHON_CMD}" to --with-python="/usr/local/bin/python3.3".

cd work/mod_wsgi3.4
vi Makefile
Change -lpython3.3 to -lpython3.3m
make install clean

cd /usr/ports/www/mod_wsgi3
make install clean
```

This registered it with pkg and installed it just like any other port.


----------



## gofer_touch (Apr 21, 2016)

I thought I would reinvigorate this thread because I am trying to do something largely similar using www/apache24 and www/mod_wsgi 4-4.4.22.

In summary I would like to use the python web user interface for the document indexer deskutils/recoll. I have taken the below described steps to install the appropriate software and have tried to configure the server based on the following documents:

Apache HTTP Server FreeBSD - https://www.freebsd.org/doc/handbook/network-apache.html

How to install and configure www/mod_wsgi on FreeBSD 8.2 - http://blog.richardknop.com/2012/01/how-to-install-and-configure-mod_wsgi-on-freebsd-8-2/

deskutils/recoll WebUI installation from scratch on a Debian/Ubuntu system - http://www.lesbonscomptes.com/recoll/pages/recoll-webui-install-wsgi.html


```
#pkg install apache24 ap24-mod_wsgi4

The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
   apache24: 2.4.18
   ap24-mod_wsgi4: 4.4.22
   apr: 1.5.2.1.5.4

cd to /usr/local/etc/apache24/ and wget the web module as a zip file
#wget https://github.com/medoc92/recoll-webui/archive/master.zip

Extract the web module
#unzip master.zip

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Navigate to the Apache httpd configuration file
ee /usr/local/etc/apache24/httpd.conf

And then modify the server ip/name
# If your host doesn't have a registered DNS name, enter its IP address
here.
#
ServerName 172.0.0.0:80

After that, remove or comment out ServerRoot, DocumentRoot and their corresponding Directory Apache directives and add this line on the bottom of the the /usr/local/etc/apache22/httpd.conf file:
Include /usr/local/www/apache24/recoll-webui-master/httpd.conf

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now navigate to edit httpd.conf

ee /usr/local/www/apache24/recoll-webui-master/httpd.conf

By adding the following:

WSGIDaemonProcess recoll user=501 group=20 \
  threads=1 processes=5 display-name=%{GROUP} \
  python-path=/usr/local/www/apache24/recoll-webui-master
WSGIScriptAlias /recoll /usr/local/www/apache24/recoll-webui-master/WebUI-wsgi.py
<Directory /usr/local/www/apache24/recoll-webui-master>
  WSGIProcessGroup recoll
  Order allow,deny
  allow from all
</Directory>


Then start the server process
#service apache24 start
```

After starting the server process I don't get a response from the address that was configured. I don't have much experience with www/apache24 and I realize that the documentation that I've provided/read spans two versions of www/apache24 and some possible FreeBSD configuration differences with the provided information in the Ubuntu guide.

I'd like to ask for help in configuring this. It seems as though it is not difficult, but I am definitely missing something. I just want this to work, I can deal with the security and fine tuning later. Help would be very appreciated!


----------



## gofer_touch (Apr 24, 2016)

Hmm. I imagine there aren't many people using this in this particular way, but does anyone have any clues as to what might have gone wrong?


----------



## anez49 (Dec 14, 2016)

Hi,

I am new to BSD, to this forum and all this stuff and it's my first post. I know it's too late to answer but I succeed to install recoll and make it work under FreeNas jail through web interface.

I installed the following package directly from the repository: with command lie :  `pkg install pkg_name_to_install`

Python 2.7:

```
py27-wxPython-common-3.0.2.0_1 GUI toolkit for the Python programming language
py27-wxPython30-3.0.2.0_1      GUI toolkit for the Python programming language
python2-2_3                    The "meta-port" for version 2 of the Python interpreter
python27-2.7.11_1              Interpreted object-oriented programming language
```

Apache Server & WCGI mode:

```
apache24-2.4.23_1              Version 2.4.x of Apache web server
ap24-mod_wsgi4-4.5.4           Python WSGI adapter module for Apache
```
Recoll:

```
recoll-1.21.6                  Personal full text search package, based on Xapian
```
Xapian:

```
xapian-core-1.2.24,1           Probabilistic text search database engine
```
And other useful package for converting from others format to text format, it depend to your need....as UNZIP ...etc.

To resume I followed this useful guide : https://www.lesbonscomptes.com/recoll/pages/recoll-webui-install-wsgi.html section Apache Variant for BSD/ports

1- You have just to pay attention to create an user example recoll.
2- connect or log to the shell with the new user and then start indexing the folder(s) you want (topdirs for more info 
see https://www.lesbonscomptes.com/reco...s/RCL.INSTALL.CONFIG.RECOLLCONF.WHATDOCS.html) with command line `recollindexer`

It's the easy way because complicated to start indexing with root and then give right access to root folder for others users (BSD will not allow).

3- along indexing recoll will create a folder named .recoll inside home directory user folder for my case is (/usr/home/recoll/.recoll).

4-Then, I configured /usr/local/etc/apache24/modules.d/270_mod_wsgi.conf as :


```
## $FreeBSD$
## vim: set filetype=apache:
##
## module file for mod_wsgi
##
## PROVIDE: mod_wsgi
## REQUIRE:

ServerName 127.0.0.1

LoadModule wsgi_module        libexec/apache24/mod_wsgi.so

WSGIDaemonProcess recoll user=recoll group=recoll \
    threads=1 processes=5 display-name=%{GROUP} \
    python-path=/usr/local/www/apache24/recoll-webui-master/
WSGIScriptAlias /recoll /usr/local/www/apache24/recoll-webui-master/webui-wsgi.py
<Directory /usr/local/www/apache24/recoll-webui-master>
        WSGIProcessGroup recoll
        Require all granted
</Directory>
```
5- restart apache server : command line : `apachectl restart`

I let all others config files to default, if you follow my method no need to touch to others config files.

And then access to recoll web user interface : http://YourServerOrIpAdress/recoll/

Everything works fine for me except preview. I think I have to install some package as OpenOffice PDF reader ...etc. (if I found the solution I will update my post)

For Apache troubleshooting you have Apache log file at : /var/log/httpd-error.log

For python troubleshoot you can run the webui.py on the python console (for more details see this page https://github.com/koniu/recoll-webui/issues/11).

Example : run python on command line and execute line by line the script webui.py to see were it stack and why 

```
user@box-media:~$ python2.7
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from recoll import recoll
>>> recoll.connect()
<recoll.Db object at 0xb73ef080>
>>>
```

I hope this will help some one, I spend 3 days to find-out how to make it work. 

Credits to recoll team.


----------



## gofer_touch (Dec 14, 2016)

This is fantastic. Thanks for posting it!

Is there is a similar way of getting this to work with nginx?


----------



## anez49 (Dec 15, 2016)

To be honest I didn't tried but you have also the description on the same page I gave before section Nginx for BSD/ports   https://www.lesbonscomptes.com/recoll/pages/recoll-webui-install-wsgi.html


----------

