0

I have some docs in rst format and want to share it like simple html pages via apache. The best tool for rendering - rst2html from python-docutils. But, I still don't know how to put these all things together. So, if I type in browser uri like this: myhost/public_docs/doc1.rst it would show me nice-looking rendered document.

Sergius
  • 908
  • 8
  • 20

1 Answers1

0

I have done it! Here is a simple solution:

1) install python-docutils to have available rst2html script (if it is not installed)

2) find out what directory with different configs included for your httpd (apache) version, on my fedora: /etc/httpd/conf.d/*.conf

3) add your own conf file here (e.g. /etc/httpd/conf.d/docs_rst.conf) with contents:

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
Action RSTHandler /cgi-bin/rst2html.sh
AddHandler RSTHandler .rst

4) according to this config add file rst2html.sh to /var/www/cgi-bin/ with contents:

#!/bin/sh
echo "Content-type: text/html"
echo ""
/usr/bin/rst2html /var/www/html/${REQUEST_URI}
exit 0

5) now you can put any rst document into any folder under /var/www/html and access it via browser (in my case: localhost/docs/test.rst)

P.S. Don't forget to reload httpd to apply all changes in config files!

Sergius
  • 908
  • 8
  • 20