/afs/csic.umd.edu/data/http
to your home directory and then build your server there.
You should first modify the file conf/httpd.conf
to make the httpd works.
conf/httpd.confhttpd.conf file is very long (>1000 lines)
because Apache has a lot of features.
Your first objective is to setup your server,
such that it can display some static contents (e.g. some html files).
Read Apache HTTP Server Version 2.0 Documentation in
http://httpd.apache.org/docs-2.0/configuring.html
User derek and Group derek.
Replace derek by your username.
/afs/csic/data/http/...
and replace them to the paths to your httpd directory.
Use the command pwd to check the full paths.
Listen directive instructs Apache
to listen to only specific IP addresses or ports.
So, setting it to 'Listen 80' results the server
listen to the port 80. You should choose some port number n with
5000 < n < 65535. Try some large and random n.
See
http://httpd.apache.org/docs-2.0/mod/mpm_common.html#listen
/usr/sbin/httpd -f /path/to/your/httpd.conf
/usr/sbin/httpd -f /path/to/your/httpd.conf -k stop
httpd processes?ps -aux | grep `whoami`
kill PID
http://bilious.csic.umd.edu:PORT_NUMBER/
ssh MACHINE_NAME.csic.umd.edu
LoadModule perl_module modules/mod_perl.so
httpd.conf.
httpd.conf,
you should edit the line for ScriptAlias
ScriptAlias /cgi-bin/ "/path/to/your/http/cgi-bin/"
/path/to/your/http/cgi-bin/ is for the executable files
while /path/to/your/http/www/ is for html files.
So, don't put cgi-bin under www.
Then, edit the corresponding directory path
<Directory "/path/to/your/http/cgi-bin/">
AddHandlerAddHandler cgi-script cgi
pl.
/path/to/your/http/cgi-bin/time.cgi
*** the content in time.cgi *** #!/bin/sh echo "Content-type: text/html" echo echo '<h1>Current server time is</h1>' date ******* end of time.cgi *******You should add executable permission to
time.cgi.
Then, check the URL
http://HOSTNAME.csic.umd.edu:PORT/cgi-bin/time.cgi
http://squeamish.csic.umd.edu:18099/cgi-bin/time.cgi
http://www.perldoc.com/perl5.6/lib/CGI.html
httpd.conf by the startserver script.
For example, you can do it by following steps:
httpd.conf to my.conf.
my.conf, modify the Listen directive to
Listen MY_SERVER_PORT
startserver,
replace MY_SERVER_PORT by the actual port number (e.g. 18099).
You can do it by the command sed.
cat my.conf | sed -e s/MY_SERVER_PORT/18099/g > httpd.conf
httpd as usual
httpd.confmy.conf,
you may use MY_USERNAME for username
and MY_HTTPD_ROOT for httpd path.
Then, you can replace everything in startserver script by:
cat my.conf | sed -e s/MY_USERNAME/`whoami`/g
| sed -e s/MY_SERVER_PORT/18099/g
| sed -e s\%MY_HTTPD_ROOT%`pwd`%g > httpd.conf
The command above must be in one line.
As you know, you can get current directory by pwd
and current username by whoami.
hostname.
foo-bar.tar.gz.
You should try the following:
foo-bar.tar.gz
cd phw03
make
./startserver 23564
startserver to a browser
./stopserver