title: How to run cgi script on apache server
body: <p>This is my program:</p>
  
  <pre><code>[root@localhost cgi-bin]# locate first.pl 
  /home/Ram/Desktop/work/first.pl
  /usr/local/apache2/cgi-bin/first.pl
  [root@localhost cgi-bin]# cd /usr/local/apache2/cgi-bin/
  [root@localhost cgi-bin]# vi first.pl 
  #!/usr/bin/perl -w
  use warnings;
  use warnings;
  use CGI;
  print "content-type: text/html\n\n";
  print "&lt;h2&gt;Hello, World!&lt;/h2&gt;\n";
  </code></pre>
  
  <p>I am calling the script from my browser like this:</p>
  
  <blockquote>
    <p><a href="http://localhost/usr/local/apache2/cgi-bin/first.pl" rel="nofollow">http://localhost/usr/local/apache2/cgi-bin/first.pl</a></p>
  </blockquote>
  
  <p>I didn't get output, but I'm getting an error:</p>
  
  <blockquote>
    <p>Not Found</p>
    
    <p>The requested URL /usr/local/apache2/cgi-bin/first.pl was not found on this server.</p>
    
    <p>Apache/2.2.15 (CentOS) Server at localhost Port 80</p>
  </blockquote>
  
  <p>I checked in web browser whether the Apache web server is working or not by using :</p>
  
  <blockquote>
    <p><a href="https://localhost" rel="nofollow">https://localhost</a></p>
  </blockquote>
  
  <p>It us showing the welcome page.</p>
  
  <p>How do I resolve this error? </p>