Installing Web Server and MySQL Database Server

This command will install Apache, MySQL, PHP, Perl and other dependencies.

yum -y install httpd httpd-devel mod_perl mod_ssl php php-devel php-cli php-mbstring php-gd php-mcrypt php-mysql php-pdo php-suhosin phpmyadmin

Test if PHP is working fine, create a file called phpinfo.php and put it in your /var/www/html.
The file shout contain this php code:

<?php phpinfo(); ?>

Open up your web browser and type this url http://localhost/phpinfo.php.
You should see something like this:

phpinfo.php file

Generate Self Signed SSL Certificate

The ChilliSpot login page hotspotlogin.cgi requires https. Go to /etc/pki directory and generate a private key using openssl command as shown below:

openssl genrsa -des3 -out server.key 1024

This command will prompt you for a pass-phrase, you can type any password you want.

Generating RSA private key, 1024 bit long modulus
.................++++++
.....++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:

Remove pass-phrase from the key, this will prevent the web server from asking pass-phrase each time you reboot the server.

openssl rsa -in server.key -out server.pem

Using the key we generated, we will then create a certificate signing request (CSR) file.

openssl req -new -key server.key -out server.csr

During the generation of CSR, you will be prompted for several pieces of information as shown below.

Enter pass phrase for server.key:Your pass-phrase here
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:PH
State or Province Name (full name) []:Kalibo
Locality Name (eg, city) [Default City]:Kalibo
Organization Name (eg, company) [Default Company Ltd]:Private Hotspot Ltd.
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Generate a self-signed ceftificate by typing this command:

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Enter your pass-phrase and you're done

Signature ok
subject=/C=PH/ST=Kalibo/L=Kalibo/O=Private Hotspot Ltd.
Getting Private key
Enter pass phrase for server.key:

Lets intall the certificate, edit the file

vi /etc/httpd/conf.d/ssl.conf

and put your newly created certificate.

#   Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate.  If
# the certificate is encrypted, then you will be prompted for a
# pass phrase.  Note that a kill -HUP will prompt again.  A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/server.crt

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/server.pem

Then start the web server and make sure it will automatically starts at boot.

service httpd restart
chkconfig httpd on

Configuring MySQL database

Start the MySQL server

service mysqld start

Configure password for MySQL root user

mysql -u root
set password for root@localhost = PASSWORD ('your_password');

And allow it to run during boot.

chkconfig mysqld on