Announcing mod_reset for Apache 2.x
access_time
hourglass_empty
person_outline

Announcing mod_reset for Apache 2.x

In the previous post we wrote about the new project Awex. With that in mind, we are happy to announce a custom module for Apache 2.x named mod_reset.

What is mod_reset?

mod_reset is a module for both Apache versions including 2.2 and 2.4. It simply looks at the headers you’ve set in the Apache configuration and overwrites the PHP settings. Let’s say we want to set memory_limit dynamically for a certain application. The Apache configuration will look like this:

ResetHeaders "memory_limit" "X-Memory-Limit"

This snippet translates to: Look at X-Memory-Limit HTTP header and set the value from this header to PHP memory_limit. You might wonder why you should use this module when there are other solutions like mod_fcgid, mod_lsapi. That’s because we want to use mod_php, run a single PHP version per container, and have a reverse proxy in front of this fleet of containers. Secondly, mod_fcgid is not developed anymore, while mod_lsapi has to run on CloudLinux which is proprietary and not free.

In addition, this module allows you to overwrite DocumentRoot, ServerAdmin, and the TMPDIR environment on request from headers too. For instance:

ResetHeader "ServerAdmin" "X-Server-Admin"
ResetHeader "DocumentRoot" "X-Document-Root"

Setting TMPDIR environment per request allows you to make sure the client is not using /tmp anymore for temporary files. This way, the files quota will be calculated more granularly.

If you are interested in mod_reset, get it on Github and give it a try.

The author

Author

Donatas Abraitis / @ton31337

Related stories

Leave a reply

Please fill the required fields.Please accept the privacy checkbox.Please fill the required fields and accept the privacy checkbox.

Comment

Name*

Email*

Thank you! Your comment has been successfully submitted. It will be approved within the next 24 hours.

Become a part of Hostinger now!