{"id":66,"date":"2016-09-29T10:46:29","date_gmt":"2016-09-29T10:46:29","guid":{"rendered":"http:\/\/blog.hostinger.io\/blog\/?p=66"},"modified":"2022-09-26T16:17:19","modified_gmt":"2022-09-26T16:17:19","slug":"mod-reset","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/blog\/mod-reset","title":{"rendered":"Announcing mod_reset for Apache 2.x"},"content":{"rendered":"<p>In the previous <a href=\"https:\/\/www.hostinger.com\/blog\/engineering\/awex-ipv6\">post<\/a> we wrote about the new project Awex. With that in mind, we are happy to announce a custom module for Apache 2.x named <code>mod_reset<\/code>.<\/p><h2 id=\"whatismod_reset\">What is mod_reset?<\/h2><p>mod_reset is a module for both Apache versions including 2.2 and 2.4. It simply looks at the headers you&rsquo;ve set in the Apache configuration and overwrites the PHP settings. Let&rsquo;s say we want to set <code>memory_limit<\/code> dynamically for a certain application. The Apache configuration will look like this:<\/p><pre><code>ResetHeaders \"memory_limit\" \"X-Memory-Limit\"<\/code><\/pre><p>This snippet translates to: Look at <code>X-Memory-Limit<\/code> HTTP header and set the value from this header to PHP <code>memory_limit<\/code>. You might wonder why you should use this module when there are other solutions like <code>mod_fcgid<\/code>, <code>mod_lsapi<\/code>. That&rsquo;s because we want to use <code>mod_php<\/code>, run a single PHP version per container, and have a reverse proxy in front of this fleet of containers. Secondly, <code>mod_fcgid<\/code> is not developed anymore, while&nbsp;<code>mod_lsapi<\/code> has to run on CloudLinux which is proprietary and not free.<\/p><p>In addition, this module allows you to overwrite <code>DocumentRoot<\/code>, <code>ServerAdmin<\/code>, and the <code>TMPDIR<\/code> environment on request from headers too. For instance:<\/p><pre><code>ResetHeader \"ServerAdmin\" \"X-Server-Admin\"\r\nResetHeader \"DocumentRoot\" \"X-Document-Root\"<\/code><\/pre><p>Setting <code>TMPDIR&nbsp;<\/code>environment&nbsp;per request allows you to make sure the client is not using <code>\/tmp<\/code> anymore for temporary files. This way, the files quota will be calculated more granularly.<\/p><p>If you are interested in <a href=\"https:\/\/github.com\/hostinger\/mod_reset\" target=\"_blank\" rel=\"nofollow noopener\">mod_reset<\/a>, get it on Github and give it a try.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.<br \/>\nWhat is mod_reset?<br \/>\nmod_reset\u2026<\/p>\n","protected":false},"author":39,"featured_media":228,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"hashtags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineering"],"hreflangs":[],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":9,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":3853,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/posts\/66\/revisions\/3853"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/media\/228"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/tags?post=66"},{"taxonomy":"hashtags","embeddable":true,"href":"https:\/\/www.hostinger.com\/blog\/wp-json\/wp\/v2\/hashtags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}