LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating a cgi-bin folder (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-cgi-bin-folder-938111/)

Freddythunder 04-04-2012 12:51 PM

Creating a cgi-bin folder
 
Hello, I tried asking my question in another forum and no one answered so either it's a really hard question.. or a really dumb question. I've done hours of searching for my answer but cannot find anything. But I may be using the incorrect nomenclature.

So, I'm a PHP programmer who's newer to linux. I have written a script in C that talks to mysql. I have future plans for this as it would be quicker than PHP. We have a dedicated server at goDaddy that has a cgi-bin, but it's not accessible from http. I think this is due to internal IP mapping. Both IP addresses that go to this server are internally pointed to two separate accounts.

I want to create a cgi-bin in those created accounts to run the (compiled) C scripts when accessed from a browser. I did find this, can I adjust the httpd.conf file at this point to "move" the cgi-bin file to inside the public_html folder in the setup account? Or is there a better way to "create" a new cgi-bin using command line?

Thanks!

Code:

# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are trested as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>


bathory 04-04-2012 02:00 PM

Hi and welcome to LQ,

If you want to run cgi scripts from inside a user's public_html directory, instead of the global /cgi-bin, you can do the following:
Code:

ScriptAlias /cgi-bin/ "/home/user/public_html/cgi-bin"
<Directory /home/user/public_html/cgi-bin>
Options +ExecCGI
AddHandler cgi-script .cgi
Allow from all
</Directory>

Regards

Freddythunder 04-04-2012 02:06 PM

I will give that a try - thank you!


All times are GMT -5. The time now is 11:25 PM.