I had some fun setting up this code explorer based on the ctags called elixir, its an interesting little bit of python wrapping ctags and providing a fairly nice interface to explore C/C++. The main part is that it indexes C/C++ identifiers so you can search by indentifier and see where it’s used in the codebase. I found it a bit annoying to setup the web ui with nginx as the only instructions are for Apache configs that make use of a few rewrite rules and CGI, so here follows the simple nginx rules to get it running.


First we are going to need a CGI implementation, I found uwsgi which had at least some documentation and it was fairly easy to setup and run with nginx packages available on ubuntu 17.04.

On Ubuntu nginx already contains uwsgi support and the uwsgi-core is already built with cgi plugin support. So we just need to make sure we have them both. On other platforms you may need to compile the uwsgi-core with cgi support as mentioned on the docs

$ apt install uwsgi-core nginx

Now we will want a uwsgi.ini to configure the uwsgi application to behave like a CGI frontend. Here is an example of what I used, and I placed this in the elixir /http dir with web.py for simplicity.

plugins = cgi
socket =
chdir = /path/to/elixir/http
cgi = /path/to/elixir/http
cgi-allowed-ext = .py
env = LXR_PROJ_DIR=/path/to/LXR_PROJ_DIR
processes = 1
threads = 1


Now we can make a simple nginx conf equivalent to whats provided by the elixir documentation.

# This just gets our root to redirect to the latest tag available.
location = / {
    return 301 my-code-base/latest/source;

include uwsgi_params;
# uwsgi doesnt set this like CGI, so set it manually.
uwsgi_param SCRIPT_URL $request_uri;
# apply the rewrite rules from the Apache conf
rewrite ^/.*/(source|ident|search) /web.py last;

location /web.py {
    # We need this to use CGI in uwsgi
    uwsgi_modifier1 9;
    # This is the local socket we will be running uwsgi on.
    # Tweak accordingly.

location / {
    # We use some static files in the repo's http folder
    root /path/to/elixir/http;
    try_files $uri =404;

Running it all

Now we just need to run it. Place your nginx conf in the appropriate dir for your distribution and restart it. Once nginx is ready you can start the uwsgi application by using uwsgi /path/to/elixir/http/uwsgi.ini

Once everything is running your elixir page should now be available! Have fun and explore your code!