logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: cant get cgi to work
Author
mrwhitee



Joined: 21 Oct 2010
Posts: 1
Location: Dallas

PostPosted: Thu 21 Oct '10 23:07    Post subject: cant get cgi to work Reply with quote

I cant get cgi to work on my centos box. I have been trying for two days and changed several directives in the httpd file that I have googled but nothing works. I am new to Apache so I figure maybe I have something else configured wrong.

I have all 3 domains in the home folder > username folder> htdocs folder

So its

home/username1/htdocs/cgi-bin < domain 1 is here. html is in htdocs and cgi in cgi


home/username2/htdocs/cgi-bin < domain 2 is here. html is in htdocs and cgi in cgi


home/username3/htdocs/cgi-bin < domain 3 is here. html is in htdocs and cgi in cgi

domain 3 is where I need cgi to work at the moment but I want the others to be able to have it too.

below is my httpd file. I changed the actual user names and domain names.



ServerRoot "/etc/httpd"

PidFile run/httpd.pid

<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>

<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

Include conf.d/*.conf

User apache
Group apache

DocumentRoot "/var/www/html"

<Directory "/var/www/html">

Options Indexes FollowSymLinks
AllowOverride ALL
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.html.var
ErrorLog logs/error_log

CustomLog logs/access_log combined
ScriptAlias /cgi-bin/ "/home/username3/htdocs/cgi-bin/"

<Directory "/home/username3/htdocs/cgi-bin">
AllowOverride all
Options +Indexes +ExecCGI
Order allow,deny
Allow from all
</Directory>

IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

AddDefaultCharset UTF-8

AddHandler cgi-script .cgi .pl

AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

<IfModule mod_proxy.c>
ProxyRequests On

<Proxy *>
Order deny,allow
Deny from all
Allow from .example.com
</Proxy>

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/usernama1/htdocs
ServerName www.domain1.com:80
<Directory "/home/username1/htdocs">
allow from all
Options +Indexes
</Directory>
ServerAdmin sales@.com
ServerAlias domain1.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/home/username2/htdocs"
ServerName www.domain2.com:80
<Directory "/home/username2/htdocs">
allow from all
Options +Indexes
</Directory>
ServerAdmin sales@.com
<VirtualHost *:80>
DocumentRoot /home/username3/htdocs
ServerName www.domain3.com:80
<Directory "/home/username3/htdocs">
allow from all
Options +Indexes
</Directory>
AddHandler cgi-script .cgi .pl
ServerAlias domain3.com
</VirtualHost>



html and php sites are working fine. I just cant get cgi to work

Please help if possible.

Mod note: remove all standard stuff from the config file. We know it! No need to post the whole config file!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 25 Oct '10 11:46    Post subject: Reply with quote

You have to put
Code:

ScriptAlias /cgi-bin/ "/home/username3/htdocs/cgi-bin/"

<Directory "/home/username3/htdocs/cgi-bin">
AllowOverride all
Options +Indexes +ExecCGI
Order allow,deny
Allow from all
</Directory>


into each vhost with the different PATHS and remove the global script alias.
Back to top


Reply to topic   Topic: cant get cgi to work View previous topic :: View next topic
Post new topic   Forum Index -> Apache