apache .html

Posted on 2006-04-19
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, 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

    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

    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
    LVL 23

    Expert Comment

    LVL 27

    Accepted Solution

    '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

    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

    this is my conf file

    PidFile logs/
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    <IfModule mpm_winnt.c>
    ThreadsPerChild 250
    MaxRequestsPerChild  0
    Listen 8080
    LoadModule access_module modules/
    LoadModule actions_module modules/
    LoadModule alias_module modules/
    LoadModule asis_module modules/
    LoadModule auth_module modules/
    LoadModule autoindex_module modules/
    LoadModule cgi_module modules/
    LoadModule dir_module modules/
    LoadModule env_module modules/
    LoadModule imap_module modules/
    LoadModule include_module modules/
    LoadModule isapi_module modules/
    LoadModule log_config_module modules/
    LoadModule mime_module modules/
    LoadModule negotiation_module modules/
    LoadModule setenvif_module modules/
    LoadModule userdir_module modules/

    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

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

    Expert Comment

    I don't see:

    AddHandler cgi-script .cgi

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    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…
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now