{"id":131,"date":"2017-07-01T00:16:42","date_gmt":"2017-06-30T18:46:42","guid":{"rendered":"https:\/\/www.coimbatorewebhosting.com\/blog\/?p=131"},"modified":"2017-07-01T12:05:16","modified_gmt":"2017-07-01T06:35:16","slug":"troubleshooting-common-apache-issues","status":"publish","type":"post","link":"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/","title":{"rendered":"Troubleshooting Common Apache Issues"},"content":{"rendered":"<p>This post will \u00a0provides troubleshooting guidelines for the Apache web server. Apache is a highly customize able tool for serving HTTP traffic. Because it allows for so many different configurations and settings in so many different places, sometimes Apache configuration can befuddle even advanced users.<\/p>\n<p>In this guide, you\u2019ll start with some basic troubleshooting steps and then proceed to more advanced techniques that can help you untangle conflicting directives. We recommend starting at the beginning of this guide and going through it in order. By the time you\u2019re done, you should be able to debug your Apache installation.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Is_Apache_Running\" >Is Apache Running?<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Restarting_Apache\" >Restarting Apache<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Reloading_Apache\" >Reloading Apache<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Checking_the_Logs\" >Checking the Logs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Enabling_Verbose_Logs\" >Enabling Verbose Logs<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Restart_Apache\" >Restart Apache:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Checking_Syntax\" >Checking Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Checking_Virtual_Host_Definitions\" >Checking Virtual Host Definitions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/troubleshooting-common-apache-issues\/#Troubleshooting_Conflicting_Directives\" >Troubleshooting Conflicting Directives<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"Is_Apache_Running\"><\/span>Is Apache Running?<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>First, \u00a0we want to check whether Apache is running.\u00a0If it isn\u2019t, go ahead and restart Apache,<\/p>\n<p>You may also want to investigate the possibility of \u00a0memory issues\u00a0if Apache is stopping unexpectedly.<\/p>\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"Restarting_Apache\"><\/span><span style=\"color: #000000;\"><span style=\"font-family: Lato, sans-serif;\">Restarting Apache<\/span><\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Even if Apache is running, it can be useful to restart the server. This will let you read the Apache start-up message. If you get an error, you can use the text of the error in an online search to help you find more details and solutions. Restarting the server may produce several seconds of downtime.<\/p>\n<p>Debian and Ubuntu:<\/p>\n<p class=\"western\"><span style=\"color: #ff0000;\">sudo service apache2 restart <\/span><\/p>\n<p><span style=\"color: #333333;\"><span style=\"font-family: Helvetica, Arial, sans-serif;\"><span style=\"font-size: medium;\">Fedora and CentOS:<\/span><\/span><\/span><\/p>\n<p class=\"western\"><span style=\"color: #ff0000;\">sudo service httpd restart<\/span><b><\/b><\/p>\n<p><span style=\"font-family: Helvetica, Arial, sans-serif;\">You can use one of the following three commands instead, depending on your Linux distribution:<br \/>\n<\/span><\/p>\n<p><span style=\"color: #ff0000;\">etc\/init.d\/httpd restart<\/span><\/p>\n<p class=\"western\"><span style=\"color: #ff0000;\">\/etc\/init.d\/apache2 restart<\/span><\/p>\n<p class=\"western\"><span style=\"color: #ff0000;\">\/etc\/rc.d\/httpd restart<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Reloading_Apache\"><\/span>Reloading Apache<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Restarting or reloading Apache is also useful if you\u2019ve recently made changes to your server, but they don\u2019t seem to be taking effect. This is true for changes made directly in the Apache configuration files, as well as for changes you\u2019ve made to the configuration for a dynamic language like \u00a0mod_python, mod_rails\u00a0(for example, Phusion Passenger, or mod_rack)\u00a0mod_ruby,\u00a0etc. These interfaces cache code internally, and do not reread scripts on new requests.<\/p>\n<p>Reloading makes Apache reread its configuration files and incorporate the changes without a full restart, which avoids web server downtime. To reload Apache\u2019s configuration, run the following command:<\/p>\n<p>Debian and Ubuntu:<\/p>\n<p><span style=\"color: #ff0000;\">\/etc\/init.d\/apache2 reload<\/span><\/p>\n<p>Fedora and CentOS:<\/p>\n<p><span style=\"color: #ff0000;\">\/etc\/init.d\/httpd reload<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Checking_the_Logs\"><\/span>Checking the Logs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The best place to check for Apache errors is the Apache error logs. To view the error logs, we recommend using the tail command with the-f flag, which shows you the most recent part of the log live as it\u2019s updated. Example:<\/p>\n<p><span style=\"color: #ff0000;\">tail -f \/var\/log\/apache2\/error.log<\/span><\/p>\n<p>The default error log locations are: <span style=\"color: #ff6600;\">Type\u00a0<\/span><span style=\"color: #ff6600;\">CTRL-C\u00a0to exit the live log.<\/span><\/p>\n<p>Debian and Ubuntu:<\/p>\n<p><span style=\"color: #ff0000;\">\/var\/log\/apache2\/error.log<\/span><\/p>\n<p>Fedora and CentOS:<\/p>\n<p><span style=\"color: #ff0000;\">\/var\/log\/httpd\/error_log<\/span><\/p>\n<p>The access logs can also help you find specific information about visitors to your server. The default access log locations are:<\/p>\n<p>Debian and Ubuntu:<\/p>\n<p><span style=\"color: #ff0000;\">\/var\/log\/apache2\/access.log<\/span><\/p>\n<p>Fedora and CentOS:<\/p>\n<p><span style=\"color: #ff0000;\">\/var\/log\/httpd\/access_log<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Enabling_Verbose_Logs\"><\/span>Enabling Verbose Logs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Sometimes it can be helpful to see extra information from Apache. You can increase the amount of detail shown in the logs by changing the log level.<\/p>\n<p>&nbsp;<\/p>\n<p>Open your Apache configuration file for editing. The Fedora and CentOS configuration file should be located at <span style=\"color: #ff6600;\">\/etc\/httpd\/httpd.conf<\/span>. This example shows the location of the Debian and Ubuntu configuration file:<\/p>\n<p><span style=\"color: #ff0000;\">sudo nano \/etc\/apache2\/apache2.conf<\/span><\/p>\n<p>Remember to set the Log Level back to warn when you\u2019re done troubleshooting, or your server may fill up with logs.Locate the\u00a0Log Level variable, and update it from the default warn to info or debug. Debug will produce the greatest amount of output.<\/p>\n<p><span style=\"color: #ff0000;\">\/etc\/apache2\/apache2.conf<\/span><\/p>\n<p><span style=\"color: #ff6600;\"># LogLevel: Control the number of messages logged to the error_log.<\/span><\/p>\n<p><span style=\"color: #ff6600;\"> # Possible values include: debug, info, notice, warn, error, crit, <\/span><\/p>\n<p><span style=\"color: #ff6600;\"># alert, emerg.<\/span><\/p>\n<p><span style=\"color: #ff6600;\"> # LogLevel debug<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Restart_Apache\"><\/span>Restart Apache:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"color: #ff0000;\">sudo service apache2 restart<\/span><\/p>\n<p>Perform the operation that was giving you trouble, then check the logs for more detailed information and errors.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Checking_Syntax\"><\/span>Checking Syntax<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Apache includes a nice little syntax checking tool. Use it to make sure you aren\u2019t missing any brackets in your configuration files (and similar problems).<\/p>\n<p>Debian and Ubuntu:<\/p>\n<p><span style=\"color: #ff0000;\">apache2ctl -t<\/span><\/p>\n<p>Fedora and CentOS:<\/p>\n<p><span style=\"color: #ff0000;\">httpd -t<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Checking_Virtual_Host_Definitions\"><\/span>Checking Virtual Host Definitions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Another helpful Apache tool lets you see all the virtual hosts on the server, their options, and the file names and line numbers of where they are defined. This will help you inventory all the<\/p>\n<p>domains that are configured on your host. It will also help you locate the correct file where you should update the configuration details for a domain, if you\u2019re not quite sure where you originally put them.<\/p>\n<p>Debian and Ubuntu:<\/p>\n<p><span style=\"color: #ff0000;\">apache2ctl -S<\/span><\/p>\n<p>Fedora and CentOS:<\/p>\n<p><span style=\"color: #ff0000;\">\u00a0httpd -S<\/span><\/p>\n<p>Make sure all your\u00a0&lt;VirtualHost&gt; directives use IP addresses and port numbers that match the ones defined in the NameVirtualHost directives.<\/p>\n<p>For example, if you have set NameVirtualHosts *:80, then the virtual host configuration should begin with &lt;VirtualHost *:80&gt;.<\/p>\n<p>If you\u2019ve set NameVirtualHosts 123.234.123.234:80, then the virtual host configuration should begin with &lt;VirtualHost 123.234.123.234:80&gt;.<\/p>\n<p>If you\u2019ve set NameVirtualHosts , then the virtual host configuration should begin with &lt;VirtualHost*&gt;\u00a0You can have multiple NameVirtualHost values, which is what you\u2019ll need to do if you\u2019re running sites on multiple IPs and ports. Just make sure the &lt;VirtualHost&gt; configurations correspond to the configured NameVirtualHostdirectives.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Troubleshooting_Conflicting_Directives\"><\/span>Troubleshooting Conflicting Directives<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you\u2019ve modified a configuration option, and you\u2019re still not seeing it take effect even after reloading the server configuration, it\u2019s possible that the new option may have been overridden by a conflicting directive. The main point to remember is that later directives override conflicting earlier ones. So, the directive that is read the latest will always be the one that takes effect.<\/p>\n<p>These points should help clarify the order in which directives are read:<\/p>\n<ul>\n<li>Remember that included files are read at the point of their inclusion, before the rest of the original file is read.<\/li>\n<li>&lt;Directory&gt; settings are read whenever the server starts or is reloaded..htaccess files, on the other hand, are read before resources are served. As a result,.htaccess files can override directory configurations. To test whether this is occurring, temporarily disable .htaccess files.<\/li>\n<li>&lt;Location&gt; directives are read after &lt;Directory&gt; and &lt;Files&gt; sections, so settings here might override other earlier settings.<\/li>\n<li>Configuration files are read serially. For example, an option set in the beginning of the apache2.conf or httpd.conf file could be overridden by a setting in the conf.d\/ file or a virtual host file.<\/li>\n<li>When an entire directory is included, the files from that directory are included sequentially (alphabetically) based on name.<\/li>\n<li>Debian and Ubuntu systems have a file called\/etc\/apache2\/ports.conf, where the NameVirtualHost and Listen directives are set. These values determine the IP address or addresses to which Apache binds, and on which port(s) the web server listens for HTTP requests. This can sometimes conflict with settings in other files.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This post will \u00a0provides troubleshooting guidelines for the Apache web server. Apache is a highly customize able tool for serving HTTP traffic. Because it allows for so many different configurations and settings in so many different places, sometimes Apache configuration can befuddle even advanced users. In this guide, you\u2019ll start [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[14],"tags":[],"class_list":["post-131","post","type-post","status-publish","format-standard","hentry","category-trouble-shootrepair"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pa2YU7-27","_links":{"self":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":0,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"wp:attachment":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}