{"id":1000,"date":"2012-08-14T11:21:16","date_gmt":"2012-08-14T03:21:16","guid":{"rendered":"http:\/\/rmohan.com\/?p=1000"},"modified":"2012-08-14T11:48:18","modified_gmt":"2012-08-14T03:48:18","slug":"recompile-apache-2-4-2-and-apache-2-2-22","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1000","title":{"rendered":"Recompile Apache 2.4.2  and Apache 2.2.22"},"content":{"rendered":"<p>How to Install Apache 2.4.2 from Source on CentOS 6.3 with SSL<\/p>\n<p>yum install gcc<br \/>\nyum install openssl-devel<\/p>\n<p>yum install apr-devel<br \/>\nyum install apr-util-devel<\/p>\n<p>yum install libtool<\/p>\n<p>yum install gcc-c++<\/p>\n<p># APR<br \/>\n# http:\/\/mirrors.axint.net\/apache\/\/apr\/apr-1.4.6.tar.gz<\/p>\n<p>tar -xvzf apr-1.4.6.tar.gz<\/p>\n<p>cd apr-1.4.6\/<\/p>\n<p>.\/configure<\/p>\n<p>make<\/p>\n<p>make install<\/p>\n<p>cd ..<\/p>\n<p># APR Utils<br \/>\n# http:\/\/mirrors.axint.net\/apache\/\/apr\/apr-util-1.4.1.tar.gz<\/p>\n<p>tar -xvzf apr-util-1.4.1.tar.gz<\/p>\n<p>cd apr-util-1.4.1<\/p>\n<p>.\/configure &#8211;with-apr=\/usr\/local\/apr<\/p>\n<p>make<\/p>\n<p>make install<\/p>\n<p>cd ..<\/p>\n<p># pcre-8.20<\/p>\n<p>ftp:\/\/ftp.csx.cam.ac.uk\/pub\/software\/programming\/pcre\/pcre-8.20.tar.gz<\/p>\n<p>tar zxvf pcre-8.20.tar.gz<\/p>\n<p>cd pcre-8.20\/<\/p>\n<p>.\/configure<\/p>\n<p>make<\/p>\n<p>make install<\/p>\n<p># Apache<\/p>\n<p>tar -zxvf apr-1.4.6.tar.gz<br \/>\ntar -zxvf apr-util-1.4.1.tar.gz<br \/>\nmv apr-1.4.6 httpd-2.4.2\/srclib\/apr<br \/>\nmv apr-util-1.4.1 httpd-2.4.2\/srclib\/apr-util<\/p>\n<p>tar -xvzf httpd-2.4.2.tar.gz<\/p>\n<p>cd httpd-2.4.2<\/p>\n<p>.\/configure &#8211;prefix=\/usr\/local\/apache2.4 &#8211;enable-ssl &#8211;enable-cgi &#8211;enable-vhost-alias &#8211;enable-rewrite &#8211;enable-proxy\u00a0 &#8211;enable-so &#8211;enable-cache &#8211;enable-disk-cache &#8211;enable-mem-cache &#8211;enable-file-cache &#8211;enable-deflate &#8211;enable-expires &#8211;enable-headers\u00a0 &#8211;enable-usertrack &#8211;enable-rewrite &#8211;with-included-apr &#8211;with-included-apr-util<\/p>\n<p>make<\/p>\n<p>make install<\/p>\n<p>httpd-2.2.22<\/p>\n<p>.\/configure &#8211;prefix=\/usr\/local\/apache2.22\u00a0 &#8211;enable-ssl &#8211;enable-cgi &#8211;enable-vhost-alias &#8211;enable-rewrite &#8211;enable-so &#8211;enable-proxy\u00a0 &#8211;enable-so &#8211;enable-cache &#8211;enable-disk-cache &#8211;enable-mem-cache &#8211;enable-file-cache &#8211;enable-deflate &#8211;enable-expires &#8211;enable-headers\u00a0 &#8211;enable-usertrack &#8211;enable-rewrite &#8211;with-included-apr &#8211;with-included-apr-util<\/p>\n<p>LoadModule slotmem_module modules\/mod_slotmem.so<br \/>\nLoadModule manager_module modules\/mod_manager.so<br \/>\nLoadModule proxy_cluster_module modules\/mod_proxy_cluster.so<br \/>\nLoadModule advertise_module modules\/mod_advertise.so<\/p>\n<p>cd ..<br \/>\n[root@HVWMOWB01 httpd-2.4.2]# \/usr\/local\/apache2\/bin\/httpd -k start<\/p>\n<p>[root@HVWMOWB01 httpd-2.4.2]# ps -ef|grep http<br \/>\nroot\u00a0\u00a0\u00a0\u00a0 29757\u00a0\u00a0\u00a0\u00a0 1\u00a0 0 15:48 ?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 00:00:00 \/usr\/local\/apache2\/bin\/httpd -k start<br \/>\ndaemon\u00a0\u00a0 29758 29757\u00a0 0 15:48 ?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 00:00:00 \/usr\/local\/apache2\/bin\/httpd -k start<br \/>\ndaemon\u00a0\u00a0 29760 29757\u00a0 0 15:48 ?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 00:00:00 \/usr\/local\/apache2\/bin\/httpd -k start<br \/>\ndaemon\u00a0\u00a0 29762 29757\u00a0 0 15:48 ?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 00:00:00 \/usr\/local\/apache2\/bin\/httpd -k start<br \/>\nroot\u00a0\u00a0\u00a0\u00a0 29844\u00a0 9441\u00a0 0 15:48 pts\/4\u00a0\u00a0\u00a0 00:00:00 grep http<\/p>\n<p>Openssl setup on the Server<\/p>\n<p>Include conf\/extra\/httpd-ssl.conf<\/p>\n<p>openssl genrsa -des3 -out server.key 1024<br \/>\nopenssl req -new -key server.key -out server.csr<br \/>\nopenssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt<br \/>\ncp server.key server.key.org<br \/>\nopenssl rsa -in\u00a0 server.key -out servernopass.key<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3><a href=\"http:\/\/ctechz.blogspot.sg\/2012\/01\/compaling-apache-php.html\">How to Compile Apache &amp; Php in linux<\/a><\/h3>\n<div><\/div>\n<p>Compiling PHP and Apache from source<\/p>\n<div>Assuming Apache source and Php source are in \/usr\/src directory.<\/div>\n<div><\/div>\n<p><strong>To compile Apache <\/strong><\/p>\n<div><strong><\/strong>$ cd \/usr\/src<\/div>\n<div>$ tar -zxvf httpd-2.0.44.tar.gz<\/div>\n<div>$ cd \/usr\/src\/httpd-2.0.44<\/div>\n<div>$ .\/configure &#8211;prefix=\/wwwroot &#8211;enable-so ( Dynamic Shared Object (DSO) Support ) this module is used to enable dso.<\/div>\n<div><\/div>\n<div>$ make<\/div>\n<div>$ make install<\/div>\n<div>$ \/wwwroot\/bin\/apachectl start<\/div>\n<div><\/div>\n<div>Now test apache installation by going to http:\/\/localhost.<\/div>\n<div>Stop apache for php installation.<\/div>\n<div><\/div>\n<div>$ \/wwwroot\/bin\/apachectl stop<\/div>\n<p><strong> To compile PHP<\/strong><\/p>\n<div>$ cd \/usr\/src $ tar -zxvf php-4.3.0.tar.gz<\/div>\n<div>$ cd \/usr\/src\/php-4.3.0<\/div>\n<div>$ .\/configure &#8211;prefix=\/wwwroot\/php &#8211;with-apxs2=\/wwwroot\/bin\/apxs &#8211;with-config-file-path=\/wwwroot\/php &#8211;with-mysql<\/div>\n<div>$ make<\/div>\n<div>$ make install<\/div>\n<div><\/div>\n<div>Now you have to edit Apache configuration file \/wwwroot\/conf\/httpd.conf.<\/div>\n<div><\/div>\n<div>If LoadModule php4_module modules\/libphp4.so line hasn&#8217;t been added by php install to \/wwwroot\/conf\/httpd.conf, then you have to add it yourself. Add it somewhere below section named &#8220;Dynamic Shared Object (DSO) Support&#8221;<\/div>\n<div><\/div>\n<div>LoadModule php4_module modules\/libphp4.so<\/div>\n<div><\/div>\n<div>Now add this line to \/wwwroot\/conf\/httpd.conf file:<\/div>\n<div><\/div>\n<div>AddType application\/x-httpd-php .php<\/div>\n<p>&nbsp;<\/p>\n<div>Start Apache now:\u00a0 $\/wwwroot\/bin\/apachectl start<\/div>\n<div>Now create a test PHP file using any text editor and add these lines to it:<\/div>\n<div>&lt;?php<\/div>\n<div>phpinfo();<\/div>\n<p>?&gt;<\/p>\n<div>Save it under \/wwwroot\/htdocs as info.php<\/div>\n<div><\/div>\n<div>Now test your PHP installation by accessing file info.php:<\/div>\n<div><\/div>\n<div>http:\/\/localhost\/info.php<\/div>\n<p><strong>DSO<\/strong><\/p>\n<div>The modules can be statically compiled into the httpd binary when the server is built. Alternatively, modules can be compiled as Dynamic Shared Objects (DSOs) that exist separately from the main httpd binary file. DSO modules may be compiled at the time the server is built, or they may be compiled and added at a later time using the Apache Extension Tool (apxs).<\/div>\n<div><\/div>\n<div>apxs is a tool for building and installing extension modules for the Apache HyperText Transfer Protocol (HTTP) server. This is achieved by building a dynamic shared object (DSO) from one or more source or object files which then can be loaded into the Apache server under runtime via the LoadModule directive from mod_so.<\/div>\n<div><\/div>\n<div>So to use this extension mechanism your platform has to support the DSO feature and your Apache httpd binary has to be built with the mod_so module. The apxs tool automatically complains if this is not the case. You can check this yourself by manually running the command.<\/div>\n<div><\/div>\n<div><\/div>\n<div>$ httpd -l<\/div>\n<div><\/div>\n<div>The module mod_so should be part of the displayed list. If these requirements are fulfilled you can easily extend your Apache server&#8217;s functionality by installing your own modules with the DSO mechanism by the help of this apxs tool:<\/div>\n<div><\/div>\n<div>$ apxs -i -a -c mod_foo.c<\/div>\n<div><\/div>\n<div>The arguments files can be any C source file (.c), a object file (.o) or even a library archive (.a). The apxs tool automatically recognizes these extensions and automatically used the C source files for compilation while just using the object and archive files for the linking phase.<\/div>\n<div><\/div>\n<div>DSO helps to add dynamic modules after we install apache.<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Install Apache 2.4.2 from Source on CentOS 6.3 with SSL<\/p>\n<p>yum install gcc yum install openssl-devel<\/p>\n<p>yum install apr-devel yum install apr-util-devel<\/p>\n<p>yum install libtool<\/p>\n<p>yum install gcc-c++<\/p>\n<p># APR # http:\/\/mirrors.axint.net\/apache\/\/apr\/apr-1.4.6.tar.gz<\/p>\n<p>tar -xvzf apr-1.4.6.tar.gz<\/p>\n<p>cd apr-1.4.6\/<\/p>\n<p>.\/configure<\/p>\n<p>make<\/p>\n<p>make install<\/p>\n<p>cd ..<\/p>\n<p># APR Utils # http:\/\/mirrors.axint.net\/apache\/\/apr\/apr-util-1.4.1.tar.gz<\/p>\n<p>tar -xvzf apr-util-1.4.1.tar.gz<\/p>\n<p>cd apr-util-1.4.1<\/p>\n<p> [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1000"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1000"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1000\/revisions"}],"predecessor-version":[{"id":1002,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1000\/revisions\/1002"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}