MTbot

= MTbot =

After moving my bot from hosting data using Apache to Nginx I decided to publish the configuration. I thought it was pretty simple but could be extremely useful for others.

Config
This is a pretty basic configuration. It looks like it and is.

server { server_name mtbot.profarius.com mtbot.DOMAIN.org; root /home/mtbot/web; autoindex on;

location /.includes { autoindex off; }

location /.private { autoindex off; }

location /logs/ { types { text/plain     txt log; }       }

location /logs/#private-channel { auth_basic "Authentication required past this point."; auth_basic_user_file /path/to/.htpasswd; }

location /meetings { auth_basic "Authentication required past this point."; auth_basic_user_file /path/to/.htpasswd; }

location ~ \.cgi { gzip off; include snips/fastcgi_params; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_pass unix:/tmp/cgi.sock; } }

Using "autoindex off;" does not prevent somebody from accessing the content. In fact, that would be counter productive. I do however, not want people looking at the contents of the directories. That's why I override the autoindex in the server block.

The "auth_basic" sections do not prevent the directories from being listed. They do however keep anyone from viewing their content without first authenticating.

The "types" block inside of the logs location tells nginx that a file with the log extension is plain/text which keeps it from needing to be downloaded on the clients end.

Finally, the CGI location block is used when a .cgi script is requested. I used this with the ban tracker and a few other things.

CGI
In order for this to work you will need to have CGI processing available. There are a few guides to this but I "hopefully" took the pain out of it. Check out fcgiwrap for more help with this.