Ruby CGI scripts that I used to set up my website https://yessiest.512mb.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.5 KiB

2 years ago
2 years ago
  1. # website.rb
  2. Ruby CGI scripts that I used to set up my website
  3. ## What is included
  4. - listing.rb - generates a recursve listing of files at your preferred location
  5. - markdown.rb - processes markdown (partially) and converts it to HTML
  6. ## How to apply this to your site
  7. - Drop all .rb files into your web directory root
  8. - Edit markdown.rb and point ROOT\_PATH to the full web directory root path
  9. - 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!)
  10. - If you're using lighttpd:
  11. - Install `mod_cgi` in your config file and add "listing.rb" as an index
  12. ```
  13. server.modules += ("mod_cgi")
  14. index-file.names += ("listing.rb")
  15. cgi.assign = (
  16. ".rb" => "/usr/bin/ruby"
  17. )
  18. ```
  19. - If you're using apache:
  20. - lmao idk
  21. - just add CGI module, make it run ruby files and make listing.rb an index
  22. - If you're using NGINX:
  23. - Install lighttpd and configure it the same way as above, but use a custom port for the server
  24. - Add `listing.rb` as an index file to your preferred location
  25. - Add a reverse proxy clause in NGINX config to proxy all .md and .rb requests to the lighttpd server
  26. ```nginx
  27. ...
  28. # pass ruby files to lighttpd
  29. location ~ \.rb {
  30. proxy_pass http://127.0.0.1:6969;
  31. }
  32. # pass .md files as query parameters to markdown.rb
  33. location ~ \.md {
  34. proxy_pass http://127.0.0.1:6969/markdown.rb?docfile=$uri;
  35. }
  36. ...
  37. ```