Tuesday, October 3, 2017

Configuring a web server

This post is mainly about configuring the web server. The html or any other programming related is not covered.

Basic web server setup

Install httpd.

yum install -y httpd

Enable and start httpd.

systemctl enable httpd
systemctl start httpd

The default content path is at /var/www/html. I created the index.html file, and try to access to it via http.


Dynamic web server using cgi

The default cgi path is at /var/www/cgi-bin.

I'll be using perl for the dynamic content.

Install perl.

yum install -y perl

The default path for cgi files are at /var/www/cgi-bin. You'll need to make the file executable.


Dynamic web server with SQL

Install MariaDB, enable and start it. MariaDB is fork of MySQL. If you are looking for a truly open-source version, this can be your choice.

yum groupinstall -y mariadb
systemctl enable mariadb
systemctl start mariadb

I just use whatever is raw available in the database. The example snippet of code below is NOT SECURE AT ALL. This is just to illustrate how it works.


Result:



There is no extra settings needed to be done on httpd configuration, and this would work perfectly. If you are looking for hosting multiple web applications, virtual host would help,  I'll be writing about it next. :)

No comments:

Post a Comment