Link to home
Start Free TrialLog in
Avatar of perlperl
perlperl

asked on

apache .html

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.
Avatar of sleep_furiously
sleep_furiously

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.

http://httpd.apache.org/docs/2.0/mod/mod_alias.html
"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.

Avatar of perlperl

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Arty K
Arty K
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
this worked and i can run html pages from cgi-bin directory but i cannot run cgi pages

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

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
</IfModule>
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>
<Directory "C:/Program Files/Apache Group/Apache2/htdocs">

    Options Indexes FollowSymLinks

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

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

<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>
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
</Directory>
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
    </Files>

    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
</Directory>

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
</Directory>

..........................................
what changes are required to run both htmland cgi pages from cgi-bin directory
i added this two line
AddType text/html .shtml
AddHandler server-parsed .shtml
didn't worjked
I don't see:

AddHandler cgi-script .cgi