Tag: protect smf forum

Secure SMF Forum with Apache

<VirtualHost *:80>
        ServerAdmin info@website.com
        ServerName forum.website.com
        ServerAlias forum.website.com
 
        DocumentRoot /var/www/forum.website.com/public/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/forum.website.com/public/>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
 
	# Protect Packages directory (only local access allowed)
 
        <Directory /var/www/forum.website.com/public/Packages/>
                Options -Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
 
        # Protect Sources directory (only local access allowed)
 
        <Directory /var/www/forum.website.com/public/Sources/>
                Options -Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
 
        # Protect .php files of Themes (no theme modification allowed)
 
        <Directory /var/www/forum.website.com/public/Themes/>
		Options -Indexes FollowSymLinks MultiViews
                Order deny,allow
                Deny from all
                <FilesMatch "\.(jpg|jpeg|gif|png|css|js)$">
                   Allow from all
                </FilesMatch>
        </Directory>
 
	# Protect attachments directory against .php .js .html files
 
        <Directory /var/www/forum.website.com/public/attachments/>
                Options -Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		Allow from All
                <FilesMatch "\.(php|js|html)$">
                   Deny from all
                </FilesMatch>
        </Directory>
 
        # Protect Settings
 
        <Location "/Settings.php">
                Order deny,allow
                deny from all
        </Location>
 
	# Protect Settings_bak
 
        <Location "/Settings_bak.php">
                Order deny,allow
                deny from all
        </Location>
 
        ErrorLog /var/log/apache2/error-forum-website-com.log
 
        LogLevel warn
 
        CustomLog /var/log/apache2/access-forum-website-com.log combined
 
</VirtualHost>