<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; apache2</title> <atom:link href="http://www.ghacks.net/tag/apache2/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Sat, 11 Feb 2012 09:52:46 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Apache troubleshooting tips</title><link>http://www.ghacks.net/2009/11/08/apache-troubleshooting-tips/</link> <comments>http://www.ghacks.net/2009/11/08/apache-troubleshooting-tips/#comments</comments> <pubDate>Sun, 08 Nov 2009 00:21:57 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Networks]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[The Web]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[apache log]]></category> <category><![CDATA[apache2]]></category> <category><![CDATA[apache2ctl]]></category> <category><![CDATA[log files]]></category> <category><![CDATA[php]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=18266</guid> <description><![CDATA[How many times have you installed a LAMP server only to find Apache doesn&#8217;t seem to want to run right? Or you install a new module only to see Apache try to download pages as file, instead of displaying them on screen? There are a hundred and one thousand things that can go wrong with [...]]]></description> <content:encoded><![CDATA[<p>How many times have you installed a LAMP server only to find Apache doesn&#8217;t seem to want to run right? Or you install a new module only to see Apache try to download pages as file, instead of displaying them on screen?</p><p>There are a hundred and one thousand things that can go wrong with any web server installation. From a fresh installation to an installation that has been running for a long time, you never know when something is going to cause your web server to go astray. When it does happen, it&#8217;s always nice to know that, usually, Occam&#8217;s Razor applies.</p><p>In this tutorial you will find some advice that will help you through some of the more common issues that can pop up with an Apache web server.</p><p><span
id="more-18266"></span><strong>Is your server actually running?</strong></p><p>Believe it or not, this has happened to plenty of administrators. You take the server down, do some maintenance, and when you go to check out the server you&#8217;re getting errors. The first thing you do, naturally, is check out that <strong>/etc/apache2/apache.conf</strong> file to make sure your syntax is correct. But it&#8217;s perfect! What&#8217;s up? The first thing you might want to check is to make sure the server is running. But you don&#8217;t want to just issue the command to start the server or reload the server. Instead, issue the command:</p><p><em>sudo /etc/init.d/apache2 status</em></p><p>Which should return something like:</p><p><em>* apache is running (pid 9751).</em></p><p>If not, start the server with either:</p><p><em>sudo /etc/init.d/apache2 start</em></p><p>or</p><p><em>sudo apache2ctl start</em></p><p>NOTE: If you are using a distribution like Fedora, SuSE, or Mandriva you will need to first <em>su </em>to the root user and issue the above commands WITHOUT using <em>sudo</em>.</p><p><strong>It&#8217;s not running and it won&#8217;t start</strong></p><p>Did you just make changes to your Apache configuration file? Are the changes correct? If you&#8217;re not sure, you can use the <em>apache2ctl </em>command to check the syntax of your configuration file. This is done with the command:</p><p><em>sudo apache2ctl configtext</em></p><p><em><span
style="font-style: normal">The above command should report:</span></em></p><p><em><span
style="font-style: normal">Syntax OK</span></em></p><p><em><strong><span
style="font-style: normal"><span
style="font-weight: normal">If you don&#8217;t get an OK, you will get information that points to the errors in your configuration file. </span></span></strong></em></p><p><em><strong><span
style="font-style: normal"><span
style="font-weight: normal"><strong>Apache wants to download .php files!</strong></span></span></strong></em></p><p><em><strong><span
style="font-style: normal"><span
style="font-weight: normal"><strong><span
style="font-weight: normal">This is another common issue. When you add a new tool on your web server (such as Drupal), if your configuration file is set up properly, any .php file might not be displayed. Instead any attempt to view a .php file will instead have your browser trying to download the file. Why is this? Apache must be informed that certain extensions are to be displayed, not downloaded. This is done from within the Apache configuration file. Open up that file (in the Ubuntu server it will be </span>/etc/apache2/apache2.conf<span
style="font-weight: normal">) and first look for the following line:</span></strong></span></span></strong></em></p><p><em><strong><span
style="font-weight: normal"><strong><span
style="font-weight: normal">DirectoryIndex index.html</span></strong></span></strong></em></p><p>If that file doesn&#8217;t include <em>index.php </em>nearly all sites that use php will be rendered useless.</p><p>The second line to look for is:</p><p><em>AddHandler application/x-httpd-php .php</em></p><p>If you find this line, and it is commented out, make sure you uncomment it by removing the &#8220;#&#8221; character. If it is not there add it to the bottom of the configuration file.</p><p>And, as always, when you make a change to the configuration file, restart Apache.</p><p><strong>Know where to look for problems</strong></p><p>Finally, it is crucial that you know where to first turn when the above doesn&#8217;t help you out. Any time I have an issue with Apache where Occam&#8217;s Razor does not apply, the first place I turn is the log files.</p><p>If you look in <strong>/var/log/apache2</strong> you will find, at least, the following files:</p><ul><li><span
style="background-color: #ffffff">access.log: This keeps track of any connection made to your server.</span></li><li><span
style="background-color: #ffffff">error.log: This keeps track of any errors that occur with Apache.</span></li><li><span
style="background-color: #ffffff">other_vhosts_access.log: This is where virtual hosts will log when the virtual host has not been prescribed its own log file.</span></li></ul><p>Of course, as your site evolves so will your available log files. Regardless of what you find in <strong>/var/log/apache2</strong>, that is where you should always first turn when you have problems. Even before you google.</p><p><strong>Final thoughts</strong></p><p>Now you should be able to handle some of the more common issues with the Apache server. And if your problem isn&#8217;t common, you also know where to turn to find clues that will lead you down the right path to correction.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/11/08/apache-troubleshooting-tips/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
