Convert Subcontext of a Web URL to lowercase using Apache Mod_Rewrite

This article focus on a requirement from a customer who wants to alter a Web URL to his website. He wanted to convert a section in the request URL to lowercase. In a nutshell, below show his requirement.

Original: http://www.example.org/App/dosomething.php
Alterd: http://www.example.org/app/dosomething.php
Continue reading

Apache 2.4.16 installation with SSL manually on RHEL 7.0/CentOS 7.0

In this article, we are going to build Apache service (2.4.16) with custom settings and install it on RHEL 7.0 from scratch with SSL support. Before we start, let’s install dependencies required.

Post build packages required,

yum groupinstall “Development Tools”
yum install openssl-devel
yum install pcre-devel

Continue reading

Apache access to Network Database on Custom port

If you have an Apache (httpd) application that needs to access a remote Database, you will have to change the SELinux policy as described bellow to allow Apache access to network databases. You have to edit the SELinux boolian settings for this.

First, check if the “httpd_can_network_connect_db” boolian set to “on”.

[root@testsrv ~]# getsebool -a | grep httpd_can_network_connect_db
httpd_can_network_connect_db --> off

By default, this is set to off. To enable network database access for Apache, execute bellow command.

setsebool -P httpd_can_network_connect_db on

Note, that “-P” is added to permanently change this setting therefore on system reboot this setting will be preserved.

If the database that the application is trying to reach is other than the default port (eg. mysql: 3306), you have to edit the SELinux Policy as described bellow.

Assume the application trying to connect to a mysql database and custom port is 1234. To get the current settings for mysql in SELinux policy,

semanage port -l | grep mysqld_port_t

To add new custom port to this mysql port group,

semanage port -a -t mysqld_port_t -p tcp 1234

Later on if you need to remove any custom port that entered in a port group, (eg: mysql:1234)

semanage port -d -t mysqld_port_t -p tcp 12345

 

Enable multiple users Read and Write permission for files within a folder

Lets assume we have two web developers working on the same web project and they will need a single shared location to store and collaborate their development work with each other. In bellow example I have taken “/var/web-dev” as the shared location and it’s owned by Apache user (www-data). Two developers, danny and penny, needs to store their development work in “/var/web-dev”.

Assuming we already has logins for danny and penny, we have to add them to Apache user group.

usermod -aG www-data danny
usermod -aG www-data penny

Continue reading

Configuring a Subversion server with Apache2 and DAV

Subversion is very popular software version and revision control system where developers can maintain current and previous versions development work. It’s gradually replacing the old Concurrent Versions System (CVS) and provide more sophistic set of features to developers. In this article I will explain you how to configure a Subversion (svn) server which uses Apache2 and DAV module. Also I presume that you have a running Apache2 service in your server.

Continue reading

Application server load balancing using Apache JServ Protocol

Apache JServ Protocol (AJP) is a binary protocol which is mainly used as an inbound web request load balancer from a web server through to an several application servers. Inbound web requests (Sessions) are redirected to correct application server using a context based routing mechanism.

 

In this example, we are focusing on Apache 2.2 which uses proxy ajp, proxy and proxy balancer as the web server while Apache Tomcat 6.0.20 and Jboss 5.1.0.GA as the application servers.First, let’s configure AJP on Apache Tomcat.

 

By default AJP 1.3 is configured in Apache tomcat and default port is 8009. You may have to change this port accordingly to eliminate port conflict with any other application servers running on the server. Let’s consider port 8011 is available and configuration will be,

  Continue reading