{"id":1941,"date":"2018-10-29T12:08:07","date_gmt":"2018-10-29T12:08:07","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=1941"},"modified":"2018-10-31T09:47:04","modified_gmt":"2018-10-31T09:47:04","slug":"compile-apache-2-4-from-source","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/29\/compile-apache-2-4-from-source\/","title":{"rendered":"Compile Apache 2.4 From Source"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/linuxadmin.io\/wp-content\/uploads\/2017\/05\/apache_processes-1.png\" alt=\"Compile Apache From Source\" width=\"667\" height=\"150\" \/><\/p>\n<p>Compiling Apache 2.4 from source is easy and allows for more customization later on. It also allows for control over where it is installed<\/p>\n<p>Install some required depedencies:<\/p>\n<p>yum install -y wget pcre-devel openssl openssl-devel expat-devel<\/p>\n<p>First get the latest version, at the time of writing this it is 2.4.25. The link to download the latest version is <a href=\"https:\/\/httpd.apache.org\/download.cgi#apache24\">here<\/a><\/p>\n<p>wget -O \/usr\/src\/httpd-2.4.25.tar.gz http:\/\/mirror.nexcess.net\/apache\/\/httpd\/httpd-2.4.25.tar.gz<\/p>\n<p>Change directories to \/usr\/src<\/p>\n<p>cd \/usr\/src<\/p>\n<p>Uncompress the tar<\/p>\n<p>tar xfvz httpd-2.4.25.tar.gz<\/p>\n<p>Go to the directory:<\/p>\n<p>cd httpd-2.4.25<\/p>\n<p>The build we are creating requires apr and apr-util so to the src lib directory and download the following (<a href=\"https:\/\/apr.apache.org\/download.cgi\">APR download page<\/a>):<\/p>\n<p>cd .\/srclib<br \/>\nwget http:\/\/mirror.stjschools.org\/public\/apache\/\/apr\/apr-1.5.2.tar.gz<br \/>\nwget http:\/\/mirrors.gigenet.com\/apache\/\/apr\/apr-util-1.5.4.tar.gz<\/p>\n<p>Uncompress them and rename them:<\/p>\n<p>tar xfvz apr-1.5.2.tar.gz; mv apr-1.5.2 apr<br \/>\ntar xfvz apr-util-1.5.4.tar.gz; mv apr-util-1.5.4 apr-util<\/p>\n<p>Configure Apache:<\/p>\n<p>Go back to the main source directory:<\/p>\n<p>cd ..\/<\/p>\n<p>To view the configure options type the following<\/p>\n<p>.\/configure &#8211;help<\/p>\n<p>This is a sample config:<\/p>\n<p>.\/configure<br \/>\n&#8211;enable-layout=RedHat<br \/>\n&#8211;prefix=\/usr<br \/>\n&#8211;enable-expires<br \/>\n&#8211;enable-headers<br \/>\n&#8211;enable-rewrite<br \/>\n&#8211;enable-cache<br \/>\n&#8211;enable-mem-cache<br \/>\n&#8211;enable-speling<br \/>\n&#8211;enable-usertrack<br \/>\n&#8211;enable-module=so<br \/>\n&#8211;enable-unique_id<br \/>\n&#8211;enable-logio<br \/>\n&#8211;enable-ssl=shared<br \/>\n&#8211;with-ssl=\/usr<br \/>\n&#8211;enable-proxy=shared<br \/>\n&#8211;with-included-apr<\/p>\n<p>Make:<\/p>\n<p>make<\/p>\n<p>Install:<\/p>\n<p>make install<\/p>\n<h3>Start Services:<\/h3>\n<p>CentOS 7<\/p>\n<p>Create a systemd start file by creating \/etc\/systemd\/system\/httpd.service and add<\/p>\n<p>[Unit]<br \/>\nDescription=The Apache HTTP Server<\/p>\n<p>[Service]<br \/>\nType=forking<br \/>\nPIDFile=\/var\/apache\/httpd.pid<br \/>\nExecStart=\/usr\/sbin\/apachectl start<br \/>\nExecReload=\/usr\/sbin\/apachectl graceful<br \/>\nExecStop=\/usr\/sbin\/apachectl stop<br \/>\nKillSignal=SIGCONT<br \/>\nPrivateTmp=true<\/p>\n<p>[Install]<br \/>\nWantedBy=multi-user.target<\/p>\n<p>Configure it to start on boot:<\/p>\n<p>systemctl enable httpd<\/p>\n<p>Start it<\/p>\n<p>systemctl start httpd<\/p>\n<p>CentOS 6<\/p>\n<p>chkconfig &#8211;add httpd<\/p>\n<p>chkconfig httpd on<\/p>\n<p>service httpd start<\/p>\n<p>That\u2019s it for compiling Apache from source. If you visit the http:\/\/ip-address of the server you should see a default page for apache.<\/p>\n<p>You can also verify its running by typing the following:<\/p>\n<p># ps aux|grep httpd<br \/>\nroot 1101 0.0 0.0 105376 836 pts\/0 S+ 21:03 0:00 grep httpd<br \/>\nnobody 15834 0.0 0.4 270908 8288 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<br \/>\nnobody 15835 0.0 0.4 270764 8224 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<br \/>\nnobody 15836 0.0 0.4 270764 8224 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<br \/>\nnobody 15837 0.0 0.4 270764 8224 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<br \/>\nnobody 15838 0.0 2.1 321656 40916 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<br \/>\nnobody 15839 0.0 1.6 292740 32276 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<br \/>\nnobody 15840 0.0 1.6 291948 31052 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<br \/>\nnobody 15841 0.0 1.6 291948 31048 ? S 03:46 0:00 \/usr\/sbin\/httpd -DHAVE_PROXY_FTP -DHAVE_AUTH_TOKEN -DHAVE_PROXY_HTTP -DHAVE_RPAF -DHAVE_PHP5 -DHAVE_XSENDFILE -DHAVE_AUTH_MYSQL -DHAVE_PROXY -DHAVE_PROXY_AJP -DHAVE_PROXY_BALANCER -DHAVE_PROXY_SCGI -DHAVE_SSL -DHAVE_PROXY_CONNECT -DSSL -DSSL -DSSL<\/p>\n<p>httpd -M will show the compiled modules:<\/p>\n<p># httpd -M<br \/>\nLoaded Modules:<br \/>\ncore_module (static)<br \/>\nauthn_file_module (static)<br \/>\nauthn_default_module (static)<br \/>\nauthz_host_module (static)<br \/>\nauthz_groupfile_module (static)<br \/>\nauthz_user_module (static)<br \/>\nauthz_default_module (static)<br \/>\nauth_basic_module (static)<br \/>\ncache_module (static)<br \/>\nmem_cache_module (static)<br \/>\ninclude_module (static)<br \/>\nfilter_module (static)<br \/>\nlog_config_module (static)<br \/>\nlogio_module (static)<br \/>\nenv_module (static)<br \/>\nexpires_module (static)<br \/>\nheaders_module (static)<br \/>\nusertrack_module (static)<br \/>\nunique_id_module (static)<br \/>\nsetenvif_module (static)<br \/>\nversion_module (static)<br \/>\nmpm_prefork_module (static)<br \/>\nhttp_module (static)<br \/>\nmime_module (static)<br \/>\nstatus_module (static)<br \/>\nautoindex_module (static)<br \/>\nasis_module (static)<br \/>\ncgi_module (static)<br \/>\nnegotiation_module (static)<br \/>\ndir_module (static)<br \/>\nactions_module (static)<br \/>\nspeling_module (static)<br \/>\nuserdir_module (static)<br \/>\nalias_module (static)<br \/>\nrewrite_module (static)<br \/>\nso_module (static)<br \/>\nssl_module (shared)<\/p>\n<h2>Configuration Changes<\/h2>\n<p>The configuration is located in \/etc\/httpd\/conf\/httpd.conf typically.<\/p>\n<h3>How to change default ports<\/h3>\n<p>Apache listens on ports by the Listen directive to change it from port 80 (default)<\/p>\n<p>Listen 8080<\/p>\n<h3>How to enable ssl in httpd.conf<\/h3>\n<p>Edit \/etc\/httpd\/conf\/httpd.conf and ensure the following line is uncommented:<\/p>\n<p>LoadModule ssl_module modules\/mod_ssl.so<\/p>\n<p>And add the following line<\/p>\n<p>Listen 443<\/p>\n<p>You will need to restart the service if you make any changes to the configuration files.<\/p>\n<p><a href=\"https:\/\/linuxadmin.io\/compile-apache-2-4-source\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compiling Apache 2.4 from source is easy and allows for more customization later on. It also allows for control over where it is installed Install some required depedencies: yum install -y wget pcre-devel openssl openssl-devel expat-devel First get the latest version, at the time of writing this it is 2.4.25. The link to download the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/29\/compile-apache-2-4-from-source\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Compile Apache 2.4 From Source&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1941","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=1941"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1941\/revisions"}],"predecessor-version":[{"id":2158,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1941\/revisions\/2158"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=1941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=1941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=1941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}