Category Archives: Web

.htaccess .htpasswd samples


AuthUserFile /home/user/domain/secretfolder/.htpasswd
AuthType Basic
AuthName "Login Details"
Require valid-user

Encryption Tool



First Make sure you have AllowOverride All option enabled


config ssmtp as mail forwarder on php.ini mail function()

Install ssmtp package

# apt-get install ssmtp

sign up on (they give us smtp server for free)

# nano /etc/ssmtp/ssmtp.conf

# nano /etc/ssmtp/revaliases


# echo test | ssmtp -s "test" test@host.tld

edit php.ini:

# nano /etc/php5/apache2/php.ini

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from =

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/ssmtp -t

# /etc/init.d/apache2 reload

using joomla contact form, this tool works 100%.

Using cgi-bin directory in Apache

Recently I tried to install a web perl application that ask me to have CGI module enabled in the Apache Web server. I’m gonna show you how this option is enabled and how it works.

If your application call CGI module you have to put it on authorized directory (this use to have a name like “cgi-bin” on server’s hosts plan). E.g You have a web page in document Root:


and into this directory there’s an index.htm calling, on one of its links, an a application that uses CGI… so to get it work create a subdirectory:

/var/www/html/cgi-bin (this subdirectory may be on another system path like $HOME/www/cgi-bin or whatever you like but it has to be able to be read and execute)

and on the httpd.conf or Apache’s configuration file submit this:

ScriptAlias /cgi-bin "/var/www/html/cgi-bin/"
<Directory "/var/www/html/cgi-bin/">
 AllowOverride all
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 order allow,deny
 Allow from all

and add the file type for the application to be identified as cgi content:

AddHandler cgi-script cgi pl ; in this case is a perl app

Then reload Apache Web Server and put the application into authorized directory and redirect all the links that call it to that path.

note: Before try, make sure that your system has installed the cgi module and perl module and this last is enabled.


Just make a .htaccess on the directory you want to enable CGI content putting the option:


and obviously you should have the AllowOverride set to all on the apache’s configuration file for that directory:

<Directory /var/www/html/cgi-bin>
AllowOverride all

But the AddHandler option must be determinated.