# website.rb Ruby CGI scripts that I used to set up my website ## What is included - listing.rb - generates a recursve listing of files at your preferred location - markdown.rb - processes markdown (partially) and converts it to HTML ## How to apply this to your site - Drop all .rb files into your web directory root - Edit markdown.rb and point ROOT\_PATH to the full web directory root path - Edit listing.rb and point ROOT\_PATH to the full web directory root path and DIR\_PATH to the directory where markdown files are located (they have to be in adirectory under root!) - If you're using lighttpd: - Install `mod_cgi` in your config file and add "listing.rb" as an index ``` server.modules += ("mod_cgi") index-file.names += ("listing.rb") cgi.assign = ( ".rb" => "/usr/bin/ruby" ) ``` - If you're using apache: - lmao idk - just add CGI module, make it run ruby files and make listing.rb an index - If you're using NGINX: - Install lighttpd and configure it the same way as above, but use a custom port for the server - Add `listing.rb` as an index file to your preferred location - Add a reverse proxy clause in NGINX config to proxy all .md and .rb requests to the lighttpd server ```nginx ... # pass ruby files to lighttpd location ~ \.rb { proxy_pass http://127.0.0.1:6969; } # pass .md files as query parameters to markdown.rb location ~ \.md { proxy_pass http://127.0.0.1:6969/markdown.rb?docfile=$uri; } ... ```