From the course: Linux System Engineer: Web Servers and DNS Using Apache, NGINX, and BIND

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Running a basic CGI script in Apache

Running a basic CGI script in Apache - Red Hat Enterprise Linux Tutorial

From the course: Linux System Engineer: Web Servers and DNS Using Apache, NGINX, and BIND

Start my 1-month free trial

Running a basic CGI script in Apache

- [Instructor] For this exercise you'll want to be logged into rhhost1 with a terminal open. We will run a script under CGI that displays some information about the web server. I've created a CGI script for you and included it in the exercise files for chapter eight. To copy the file go to your home directory where you extracted the ExerciseFiles zip archive in chapter three of this course and then type in sudo cp ExerciseFiles/Ch08/var/www/cgi-bin/ loggedin.sh /var/www/cgi-bin/ and hit enter. Now let's take a look at it. Type in less /var/www/cgi-bin/loggedin.sh. So a very simple script that presents some HTML on the screen and runs the date command. It also runs the who command. Now let's see it work. Press q to quit. Let's make it executable by typing a sudo chmod +x /var/www/cgi-bin/loggedin.sh and hit enter. We need to turn on an SELinux Boolean to allow CGI scripts. Type in clear and then type in sudo setsebool -P httpd_enable_cgi 1 and hit enter. Now let's restart Apache. Type…

Contents