Adding Custom Apache Modules
To meet all of the requirements of your application, you might need to add some custom Apache modules. Some of these are not listed among the Apache modules installed in the platform by default. You can enable your own Apache modules in the environment by following the instructions below:
Create the environment
1. Log into the PaaS account.
2. Click on Create environment at the top left corner of the dashboard.
3. In the opened wizard, navigate to the PHP tab, select the Apache application server and specify the number of resources your application needs. After that, enter the name for your environment (e.g. apachemodules) and click the Create button.
4. In several seconds your environment will appear on the platform dashboard.
Build your Apache module
1. Download Apache httpd from apxs with the same version as your Apache server. In our case we have Apache 2.2.15, so we will download and install httpd 2.2.15.
2. Download the source of the needed module in the Apache modules list. As an example we will use a funny mod_pony Apache module.
3. Compile your Apache module.
Here is how we’ve compiled our mod_pony module:
|
|
4. As a result you will get an .so file of your Apache module. We have a mod_pony.so file (/usr/lib64/httpd/modules/mod_pony.so).
Upload and configure your module
1. Navigate to your environment and click Config for your Apache server.
2. Upload mod_pony.so file to the /usr/lib64/php/modules folder.
3. Go to the /etc/httpd/conf folder and edit the httpd.conf file by adding the LoadModule string in the following format:
LoadModule {module-name}_module /usr/lib64/php/modules/{file-name}.so
Example: LoadModule pony_module /usr/lib64/php/modules/mod_pony.so
Save the changes.
4. Change the settings required for your Apache module.
For example, for further configuration of the mod_pony module we need:
- to navigate to the webroot > ROOT folder and create a .htaccess file;
- to add the following strings to the .htaccess file:
<Files pony>
SetHandler pony
</Files>
Save the changes.
5. After all of the configuration changes Restart node of your Apache server to enable Apache module.
Check the result
1. To check that the mod_pony Apache module is working, click Open in browser for your environment.
2. Add /pony to the link and refresh. As a result you have your own pony.
That’s all it takes! Just a few simple steps and you can enjoy using your own custom modules for an Apache server.