Moxa DA-682A-C7-DPP [32/108] Configuring the common gateway interface cgi

Moxa DA-682A-C7-DPP [32/108] Configuring the common gateway interface cgi
DA-682A-DPP Linux Software Managing Communications
3-14
Configuring the Common Gateway Interface (CGI)
Setting Up CGI
CGI comes already enabled. The root CGI directory (where you should put CGI scripts) is /usr/lib/cgi-bin.
You may change this to
/var/www/cgi-bin, if you so desire.
ATTENTION
If you have more questions about setting up CGI on Apache 2
.2, you may refer to this web page:
http://httpd.apache.org/docs/2.2/howto/cgi.html
Disabling CGI
Support for CGI scripting is enabled by default. To disable it, follow the steps below.
1. Open the configuration file for editing (below, we use VI):
moxa@Moxa:~# vi /etc/apache2/sites-enabled/000-default
Then, comment out the following lines:
moxa@Moxa:~#/etc# vi /etc/apache2/sites-enabled/000-default
#ScriptAlias /cgi-bin/ /usr/lib/w3m/cgi-bin/
#<Directory “/usr/lib/w3m/cgi-bin/”>
# AllowOverride None
# Options ExecCGI -MultiViews +SymLinksIFOwnerMatch
# #Order allow,deny
# Order deny,allow
# Allow from all
#</Directory>
2. Re-start the apache server.
moxa@Moxa:~# sudo service apache2 restart
ATTENTION
If you have CGI scripts you wish to transfer to the server, make sure you make the files executable. The
command for this is the
change mode command, chmod. To make a file read-
only but executable, you may
use the numerica
l combination 555. To make a file read only but available for editing by root, use the
numerical key
755. The syntax is as follows:
moxa@Moxa:~#chmod 555 /usr/lib/cgi-bin/[NAME OF YOUR FILE HERE]
Saving Web Pages to a USB Storage Device
Some applications may have web pages that take up a lot of storage space. This section describes how to save
web pages to the USB mass storage device, and then configure the Apache web server’s DocumentRoot to
open these pages. The files used in this example can be downloaded from the Internet.
1. Connect the USB storage device to a USB port, and check where the device is mounted:
moxa@Moxa:~# sudo mount
2. Prepare the web pages and then save the entire /var/www directory to the appropriate USB storage device.
Normally, this should be
/media/usb0.
moxa@Moxa:~# sudo cp –a /var/www/ media/usb0/

Содержание

Похожие устройства

Скачать