# ============== # Sample Apache 2.4 configuration, and will have to be changed to match your # setup. If anything here is unclear, check Apache documentation at # # https://httpd.apache.org/docs/2.4/ # # ================ ServerName www.example.com ServerAdmin joe@example.com DocumentRoot /www/example.com/htdocs AddHandler cgi-script .cgi # ---------------------------- # This assumes you renamed the exectuable to 'htdocs/blog/blog.cgi'. The # actual name doesn't really matter, as long as you have the Rewrite rules # set up to match the actual name. # # The following sets the environment variable BLOG_CONFIG to point to the # configuration file whenever Apache runs blog.cgi. # --------------- SetEnv BLOG_CONFIG /www/example.com/blog.conf Options All AllowOverride None Require all granted Script PUT boston.cgi # ---------------------- # It's a good idea to protect the web interface behind some form of # authentication. Here, we're protecting the POST method to require # authentication. # ---------------------- AuthType Basic AuthName "A Blog Grows in Cyberspace" AuthUserFile /www/example.com/users AuthGroupFile /www/example.com/groups Require valid-user # ----------------------- # The use of the RewriteEngine in Apache is to hide the fact that we're # generating the data with a CGI script. This isn't strictly necessary, # but I find it produces much nicer looking URLs. For our sample blog, # a given entry will have the URL of: # # http://www.example.com/blog/2011/11/28.1 # # You can also run pages through the blog engine to produce output that # matches the blog, since the file contents will be run through the # templating engine. # ---------------------- RewriteEngine on RewriteBase /blog/ RewriteRule ^([0-9][0-9])(.*) boston.cgi/$1$2 [L] RewriteRule ^about/$ boston.cgi/about/index.html [L] RewriteRule ^about/(.*) boston.cgi/about/$1 [L] RewriteRule ^addentry.html$ boston.cgi?cmd=new [L] RewriteRule ^today$ boston.cgi?cmd=today [L] RewriteRule ^(today)/(.*) boston.cgi?cmd=today&path=$1&day=$2 [L] .