|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Still no luck with cgi-bin..plz help
This is what i put in my httpd.conf :
<VirtualHost 192.168.0.2> ServerName www.domain.com ServerAdmin me@domain.com DocumentRoot /home/httpd/mydomain ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin <Directory "/home/httpd/mydomain/cgi-bin"> Options +ExecCGI </Directory> </VirtualHost> But, when i goto the script, lets say, mydomain.com/cgi-bin/thing.cgi, i get a 404 error message. Help! |
|
#2
|
|||
|
|||
|
Change
ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin to ScriptAlias /cgi-bin /home/httpd/mydomain/cgi-bin or ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin/ (notice how the last slashes have to match on the aliases) |
|
#3
|
|||
|
|||
|
You don't ExecCGI your cgi-bin if it's ScriptAlias'ed.
>> ScriptAlias /cgi-bin /home/httpd/mydomain/cgi-bin This also incorrect. You don't browse your cgi-bin directory. You access the script directly that resides in it. Just like the Alias /icons/ "/path/to/icons/". |
|
#4
|
|||
|
|||
|
so i could either do :
This is what i put in my httpd.conf : <VirtualHost 192.168.0.2> ServerName www.domain.com ServerAdmin me@domain.com DocumentRoot /home/httpd/mydomain ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin/ </VirtualHost> or <VirtualHost 192.168.0.2> ServerName www.domain.com ServerAdmin me@domain.com DocumentRoot /home/httpd/mydomain Alias /cgi-bin/ "/home/httpd/mydomain/cgi-bin/ " </VirtualHost> |
|
#5
|
|||
|
|||
|
Yes, but the 2nd one needs ExecCGI because that cgi-bin is not ScriptAlias'ed. If you set ExecCGI for <Directory "/home/httpd/mydomain">, then your cgi-bin, which is just a subdirectory under your docroot would be inherited. Actually, you don't even need Alias /cgi-bin/ "/home/httpd/mydomain/cgi-bin/" because it's under your docroot. You Alias or ScriptAlias only if it's not under your docroot.
|
|
#6
|
|||
|
|||
|
it is under doc root
lets say it is under the docroot. how would i create the cgi-bin then?
|
|
#7
|
|||
|
|||
|
Just mkdir.
|
|
#8
|
|||
|
|||
|
?
mkdir?
|
|
#9
|
|||
|
|||
|
Yes, just make a cgi-bin directory under your docroot and set it like so:
ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin/ However, cgi-bin directory shouldn't be under your docroot for security reasons. You ScriptAlias it so it's possible that your cgi-bin resides in /another/weird/path/to/cgi-bin outside of your docroot. ScriptAlias /cgi-bin/ /another/weird/path/to/cgi-bin/ The /cgi-bin/ is an absolute URL path: http://www.domain.com/cgi-bin/ cgi-bin by the name itself is NOT a special directory. You just need to mkdir to create it, just like any other directories. What makes it different from others is ScriptAlias so that all files reside in it are treated as CGI script, the scripts still need to be executable with appropriate permission though. That said, you can even set: ScriptAlias /mycgi-files/ /another/weird/path/to/some/script/directory/ So the URL would look like -> http://www.domain.com/mycgi-files/script.cgi You can also mkdir /home/httpd/mydomain/cgi-bin/ but do not specify ScriptAlias line to it. Then you need ExecCGI, but it has the same effect as a cgi-bin directory that's ScriptAlias'ed. The difference is, you can run extension-less CGI scripts in a ScriptAlias's cgi-bin. |
|
#10
|
|||
|
|||
|
yeah
i still get a 404 error, hmmff....................
|
|
#11
|
|||
|
|||
|
Look in error_log
Try reading error_log, sometimes in /var/log/httpd/error_log
A 404 error will be listed with your IP and the path of the 404 file. Look at this error information and adjust you path to suit. OR : Find the error line and post with your virtual section for extra help. Note 1: Also Apache must be restarted for changes in httpd.conf to be read. Note 2: by the path's you show you are using Linux ??? Please post again.
__________________
Thanks Foot in Mouth ver 1.2.5 Onion |
|
#12
|
|||
|
|||
|
>> i still get a 404 error
This obviously is not very helpful at all. Which approach, ScriptAlias or just a plain cgi-bin directory with ExecCGI? What was the full URL that returned 404 error? There is one thing I forgot to mention about ScriptAlias. Say you used ScriptAlias /mycgi-files/ "/another/weird/path/to/some/script/directory/" You also need to specify this: <Directory "/another/weird/path/to/some/script/directory"> AllowOverride None Options None Order allow,deny Allow from all </Directory> Since this non-standard path is not under your docroot (/home/httpd/mydomain) nor any path above was already defined, so all the Options and AllowOverride will not be inherited. |
|
#13
|
|||
|
|||
|
cgi versus perl
i did the "hello world" thing with the extension of .pl....and it worked..woohoo....then i put it to the test of another script. but this script had the .cgi extensions. when i tried to access them through the web browser, it said error 500. i looked at the "add handler" part in my httpd.conf, and i added AddHandler cgi-script .cgi .pl...is there anything else i should do to make the .cgi work?
|
|
#14
|
|||
|
|||
|
That wasn't problem with AddHandler. If .cgi is not being recognized, you would have seen a dialog prompt for download. [500] could be all sort of things.
Please answer this question ( I asked you dozen times without a reply still): Is your cgi-bin ScriptAlias'ed? No matter, your script still need execute permission. Just check your error log and solve the problem yourself. If you can't, post the 1st 5 lines of your script here. |
|
#15
|
|||
|
|||
|
yes
umm, yes, it is script alias'd. hmm, ok, i will search it.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Still no luck with cgi-bin..plz help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|