1

My document root is

 /0/

i do not have any cgi-bin directories.

this is my virtual host with apache:

Listen *:80
DirectoryIndex 1

<VirtualHost *:80>
DocumentRoot /0
ServerName domain.tld
ServerAlias www.domain.tld
</VirtualHost>

what i want to do is place a bash script in this directory.

the document root that is..

in it i will have.. ( test.sh )

#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "test"

that is all.

i suppose i need to add this line to the

/etc/sudoers

file..

 apache ALL=NOPASSWD:/0/test.sh

is this all sufficient to ensure i can actually make my web site run via bash scripts and python scripts ?

if this works.. what would be to use of things such as

mod_wsgi and python for the web ?

i suppose i also have to make test.sh executable

chmod +x test.sh

if this works out and i set document root to

index.sh

what would be the point of wasting time with python for the web frameworks. or even python itself given that bash for the web would be more direct and thus faster. ?

1

Edit the <Directory "/0" > entry in your httpd.conf file and add:

Options +ExecCGI
AddHandler cgi-script .sh 

You should end up with something similar to:

<Directory "/0" >
    ...
    Options +ExecCGI
    AddHandler cgi-script .sh 
    ...
</Directory>

Restart your server:

# service httpd restart

All the CGI files should be executable (chmod +x <cgi file>). The file will run as user apache and group apache.

Point your browser at http://<name or IP>/test.sh

CGI isn't the most efficient way of running scripts as a new process (python or bash in this case) is started for each request, but it does make it easier to implement your scripts. WSGI is a more efficient way of running Python than as a basic CGI script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.