Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


apache .html

Posted on 2006-04-19
Medium Priority
Last Modified: 2010-03-04
i installed apache
and i save my .cgi scripts in /cgi-bin directory...
when i save .html files on /chi-bin directory and open it from browser, i get

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@admin.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Question by:perlperl
LVL 10

Expert Comment

ID: 16489928
If you configured your /cgi-bin using ScriptAlias (I believe this is the case for the default httpd.conf), then it expects everything in that directory to be a script.  So it is trying to execute your html page as a CGI and failing.

"The ScriptAlias directive has the additional effect of marking the target directory as containing only CGI scripts."

If you want to put your CGI and static content in the same directory, then don't use ScriptAlias, use a file extension to mark CGIs instead, such as:

   AddHandler cgi-script .cgi

The directory that your CGI scripts are in needs to have:
   Options ExecCGI.


Author Comment

ID: 16489972
this is what i have in conf file

AddHandler cgi-script .cgi

# For files that include their own HTTP headers:
#AddHandler send-as-is asis

# For server-parsed imagemap files:
#AddHandler imap-file map

# For type maps (negotiated resources):
# (This is enabled by default to allow the Apache "It Worked" page
#  to be distributed in multiple languages.)
AddHandler type-map var

# Filters allow you to process content before it is sent to the client.
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)

#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml

what changes do i need to run .html files from cgi-bin directory
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

LVL 27

Accepted Solution

Nopius earned 2000 total points
ID: 16496309
'what changes do i need to run .html files from cgi-bin directory'
Why to 'run' .html files? May be you like to browse them?
If you want this,
ScriptAlias /cgi-bin ...
Alias /cgi-bin ...

and add directory section for "/usr/local/apache/cgi-bin" or where your real scripts are located
<Directory /usr/local/apache/cgi-bin>
  Options ExecCGI

Author Comment

ID: 16502304
this worked and i can run html pages from cgi-bin directory but i cannot run cgi pages

You don't have permission to access /cgi-bin/test.cgi on this server.


Author Comment

ID: 16502368
this is my conf file

PidFile logs/httpd.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild  0
Listen 8080
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imap_module modules/mod_imap.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule userdir_module modules/mod_userdir.so
ServerAdmin test@blah.com

ServerName blahcom:8080

UseCanonicalName Off
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"

<Directory />
    Options FollowSymLinks +ExecCGI
    AllowOverride None
<Directory "C:/Program Files/Apache Group/Apache2/htdocs">

    Options Indexes FollowSymLinks

    AllowOverride None
    Order allow,deny
    Allow from all
UserDir "My Documents/My Website"

DirectoryIndex index.cgi index.html index.htm
AccessFileName .htaccess
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
TypesConfig conf/mime.types
DefaultType text/plain

<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
HostnameLookups Off
ErrorLog logs/error.log

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access.log common
ServerTokens Full

ServerSignature On

Alias /icons/ "C:/Program Files/Apache Group/Apache2/icons/"

<Directory "C:/Program Files/Apache Group/Apache2/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$ "C:/Program Files/Apache Group/Apache2/manual$1"

<Directory "C:/Program Files/Apache Group/Apache2/manual">
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all

    <Files *.html>
        SetHandler type-map

    SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ prefer-language=$1
    RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2

Alias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
<Directory "C:/Program Files/Apache Group/Apache2/cgi-bin">
    Options ExecCGI
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

what changes are required to run both htmland cgi pages from cgi-bin directory

Author Comment

ID: 16502539
i added this two line
AddType text/html .shtml
AddHandler server-parsed .shtml
didn't worjked
LVL 27

Expert Comment

ID: 16504923
I don't see:

AddHandler cgi-script .cgi

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question