Category Archives: Web

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

Install ssmtp package

# apt-get install ssmtp

sign up on http://www.gawab.com (they give us smtp server for free)

# nano /etc/ssmtp/ssmtp.conf

root=user@gawab.com
mailhub=smtp.gawab.com:25
hostname=user@gawab.com
FromLineOverride=YES
AuthUser=user
AuthPass=userpass

# nano /etc/ssmtp/revaliases

root:user@gawab.com:smtp.gawab.com:25

testing:

# 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 = me@example.com

; 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:

/var/www/html

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
</Directory>

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.

FOR MULTIPLE DIRECTORIES

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

+ExecCGI

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
</Directory>

But the AddHandler option must be determinated.