Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 14. Web Services > CGI Applications

CGI Applications

Now that you know how to configure and secure a web server, let’s look at some more advanced deployments and how to share data. For this first example, let’s deploy a CGI application on the web server.

Step 1.
Create a directory to hold your web application:

# mkdir /var/www/web-app-01

Step 2.
Copy any required files into the newly created directory:

# cp /home/user01/app.py /var/www/web-app-01

Note

You can get the app.py from http://sourceforge.net/projects/rhcelabscripts/.

Step 3.
Add the following section to your /etc/httpd/conf/httpd.conf file:

ScriptAlias /webapp "/var/www/web-app-01"
<Directory "/var/www/web-app-01/">
    Options ExecCGI FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

Step 4.
Check the config file for syntax errors:

# service httpd configtest
Syntax OK

Step 5.
Set the correct permissions for the directory:

# chmod 755 –R /var/www/web-app-01

Step 6.
Restart the web service:

# service httpd restart
Stopping httpd:                                        [  OK  ]
Starting httpd:                                        [  OK  ]


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial