What did I do?
I have install all the prerequisites listed in the Makefile including:
- apache2
- libwfdb
- libcurl
- perl and cgi.pm
I copied the lw-apache.conf from ./server to /etc/apache2/sites-enabled/ and here is my lw-apache.conf file after edited:
# Sample Apache configuration to be added to Apache's conf.d directory
# (typically /etc/httpd/conf.d or /etc/apache2/conf.d)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost
<IfModule mod_deflate.c>
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/html'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/plain'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/css'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/javascript'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/javascript'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/json'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/rss+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/atom+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/svg+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/x-icon'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'font/opentype'"
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes
</IfModule>
<IfModule !mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
AddOutputFilterByType DEFLATE application/javascript application/json
AddOutputFilterByType DEFLATE application/xml application/rss+xml
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
DocumentRoot /home/physionet/html
<Directory />
HeaderName HEADER.html
Options Indexes Includes FollowSymLinks
IndexOptions FancyIndexing IconHeight IconWidth SuppressHTMLPreamble
AllowOverride FileInfo Indexes
order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /home/physionet/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# see comment below
# Header set Access-Control-Allow-Origin "*"
Order allow,deny
Allow from all
</Directory>
Alias /lw/ /ptmp/lw/
<Directory /ptmp/lw>
Options -Indexes
AllowOverride None
</Directory>
<DirectoryMatch /ptmp/lw/(.)*/>
Options +Indexes
IndexIgnore ..
AllowOverride None
</DirectoryMatch>
# Logging section
LogLevel warn
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
# By default, Apache will not allow annotation backups except from LightWAVE
# clients that were loaded from the web server host. (For example, a local
# copy of the LightWAVE client loaded from a file:// URL would not be allowed
# to back up its annotations.) Uncomment the "Header set ..." directive above
# to permit "foreign" clients to do annotation backups -- but doing this may
# open your server to malicious uploads if it is on the open Internet, so
# be careful!
This is my Makefile after edited:
LWVERSION = 0.72
# file: Makefile G. Moody 18 November 2012
# Last revised: 25 January 2023 (version 0.72)
# 'make' description file for building and installing LightWAVE
#
# *** It is not necessary to install LightWAVE in order to use it!
# *** Point your browser to http://physionet.org/lightwave/ to do so,
# *** or use it to open lightwave.html (in the 'client' directory).
#
# LightWAVE is a lightweight waveform and annotation viewer and editor.
#
# LightWAVE is modelled on WAVE, an X11/XView application I wrote and
# maintained between 1989 and 2012. LightWAVE runs within any modern
# web browser and does not require installation on the user's computer.
#
# This file, and the others in this directory, can be used to install
# LightWAVE on your own web server. You might want to do this if your
# connection to physionet.org is slow or intermittent, if you want to
# use LightWAVE to work with local files, or if you want to participate
# in LightWAVE's development.
#
# Prerequisites for building and using the LightWAVE server:
# httpd (a properly configured web server, such as Apache)
# libwfdb (from http://physionet.org/physiotools/wfdb.shtml)
# libcurl (from http://curl.haxx.se/libcurl/)
#
# In addition, the LightWAVE scribe (a separate server-side CGI application
# that receives edit logs transmitted from the LightWAVE client) requires
# 'perl' and 'cgi.pm' (standard on Linux, available for all platforms from
# http://search.cpan.org/).
#
# To build and install LightWAVE using this Makefile, you will also need
# a few standard POSIX tools including 'gcc' (or another ANSI/ISO compiler)
# 'make', 'cp', 'mkdir', 'mv', 'rm', 'sed', and 'tar' (standard on Linux and
# Mac OS X, components of Cygwin on Windows).
#
# Install the three libraries where the compiler/linker will find them (on
# Linux or MacOS X, /usr/lib is usually the best choice).
#
# If you are using Apache, make sure that the values of DocumentRoot,
# ScriptAlias1, ScriptAlias2, ServerName, and User below match those given in
# your Apache configuration file.
#
# "server/lw-apache.conf" is provided to illustrate settings you might use if
# you have not previously configured Apache; it is meant as a supplement to the
# standard Apache configuration file, which contains many more settings and
# should not be edited unless you know what you are doing. If you decide to use
# "lw-apache.conf", copy it into Apache's conf.d directory, which is used for
# customized configuration modules; typically this directory is
# /etc/httpd/conf.d or /etc/apache2/conf.d, but you may need to hunt around for
# it.
#
# If you make any changes to Apache's configuration, restart Apache and verify
# that it is (still) working before continuing.
#
# Return to this directory and type 'make' to build and install LightWAVE.
# Then type 'make check' to run a basic test of the LightWAVE server.
#
# If you have installed LightWAVE on "myserver.com", start the LightWAVE client
# by pointing your browser to http://myserver.com/lightwave/. If you have
# installed LightWAVE on a standalone computer without a network connection,
# use any of these URLs:
# http://localhost/lightwave/
# http://127.0.0.1/lightwave/
# http://0.0.0.0/lightwave/
# LW_WFDB is the LightWAVE server's WFDB path, a space-separated list of
# locations (data repositories) where the server will look for requested data.
LW_WFDB = "/usr/local/database http://physionet.org/physiobank/database"
# DocumentRoot is the web server's top-level directory of (HTML) content.
# The values below and in your Apache configuration file should match.
# Note that it does not end with '/'.
DocumentRoot = /home/physionet/html
# ServerName is the hostname of the web server, as specified in your Apache
# configuration file. The default setting below attempts to guess your server's
# hostname from the output of the 'hostname' command. Servers often have
# multiple hostnames, however. If the output of 'hostname' does not match the
# value of ServerName in your Apache configuration file, change the value below
# to match the Apache configuration file.
ServerName = localhost
# ScriptAlias1 is the prefix of URLs for server scripts (CGI applications).
# It should match the first argument of the ScriptAlias directive in your
# Apache configuration file.
ScriptAlias1 = /cgi-bin/
# ScriptAlias2 is the directory in which server scripts are to be installed.
# It should match the second argument of the ScriptAlias directive in your
# Apache configuration file.
CGIDIR = /home/physionet/cgi-bin/
# User is the user who "owns" processes started by the web server.
# It should match the value of User in your Apache configuration file.
User = ntthong
# LWCLIENTDIR is the directory for the installed LightWAVE client.
LWCLIENTDIR = $(DocumentRoot)/lightwave
# The client should be installed in a subdirectory of DocumentRoot, and the
# server and scribe should go into CGIDIR.
# LWCLIENTURL, LWSERVERURL, and LWSCRIBEURL are the URLs of the installed
# LightWAVE client, server, and scribe.
LWCLIENTURL = http://$(ServerName)/lightwave/
LWSERVERURL = http://$(ServerName)$(ScriptAlias1)lightwave
LWSCRIBEURL = http://$(ServerName)$(ScriptAlias1)lw-scribe
# LWTMP is a temporary directory for server-side backup of edit logs uploaded
# from LightWAVE clients to the scribe, and annotation files created from the
# edit logs by patchann.
LWTMP = /ptmp/lw
# Directory for installation of the WFDB software package; patchann is
# installed there, where the scribe expects to find it.
WFDBROOT = /usr/local
# CC is the default C compiler.
CC = gcc
# CFLAGS is a set of options for the C compiler.
CFLAGS = -O -DLWDIR=\"$(LWCLIENTDIR)\" -DLWVER=\"$(LWVERSION)\" \
-DLW_WFDB=\"$(LW_WFDB)\"
# LDFLAGS is a set of options for the linker.
LDFLAGS = -lwfdb
# Install both the lightwave server and client on this machine.
install: server scribe client
@echo
@echo "LightWAVE has been installed. If an HTTP server is running on"
@echo "$(ServerName), run LightWAVE by pointing your web browser to"
@echo " $(LWCLIENTURL)"
# Check that the server is working.
test:
check/lw-test $(CGIDIR)
# Install the lightwave client.
client: clean FORCE
mkdir -p $(LWCLIENTDIR)
cp -pr client/* $(LWCLIENTDIR)
rm -f $(LWCLIENTDIR)/lightwave.html
baseurl=`echo "$(LWSERVERURL)" | cut -d/ -f1-3`; \
serverpath=`echo "$(LWSERVERURL)" | cut -d/ -f4-`; \
scribepath=`echo "$(LWSCRIBEURL)" | cut -d/ -f4-`; \
sed "s+'https://physionet.org'+'$$baseurl'+" \
<client/js/lightwave.js | \
sed "s+'/cgi-bin/lightwave'+'/$$serverpath'+" | \
sed "s+'/cgi-bin/lw-scribe'+'/$$scribepath'+" \
>$(LWCLIENTDIR)/js/lightwave.js
sed "s/\[local\]/$(LWVERSION)/" <client/lightwave.html \
>$(LWCLIENTDIR)/index.html
# Install the LightWAVE server.
server: lightwave
mkdir -p $(CGIDIR)
install -m 755 lightwave $(CGIDIR)
# Install the sandboxed LightWAVE server.
sandboxed-server: sandboxed-lightwave
mkdir -p $(CGIDIR)
sudo install -m 4755 sandboxed-lightwave $(CGIDIR)
# Install the LightWAVE scribe.
scribe: patchann scribedir
mkdir -p $(CGIDIR)
sed s+/usr/local+$(WFDBROOT)+ <server/lw-scribe | \
sed s+/ptmp/lw+$(LWTMP)+ >$(CGIDIR)/lw-scribe
chmod 755 $(CGIDIR)/lw-scribe
# Set up a temporary directory on the server for backups of edit logs, and
# make it writeable by the web server and the processes that it spawns.
scribedir:
[ -d $(LWTMP) ] || sudo mkdir -p $(LWTMP)
sudo chmod 755 $(LWTMP)
sudo cp -p server/download.html $(LWTMP)
sudo chown $(User) $(LWTMP)
# Compile the lightwave server.
lightwave: server/lightwave.c server/cgi.c server/*.h
$(CC) $(CFLAGS) server/lightwave.c server/cgi.c -o lightwave $(LDFLAGS)
# Compile the sandboxed lightwave server.
sandboxed-lightwave: server/lightwave.c server/cgi.c server/sandbox.c server/*.h
$(CC) $(CFLAGS) -DSANDBOX -DLW_ROOT=\"$(LW_ROOT)\" \
server/lightwave.c server/cgi.c server/sandbox.c \
-o sandboxed-lightwave $(LDFLAGS) -lseccomp -lcap
# Compile and install patchann.
patchann: server/patchann.c
$(CC) $(CFLAGS) server/patchann.c -o $(WFDBROOT)/bin/patchann $(LDFLAGS)
# Make a tarball of sources.
tarball: clean
cd ..; tar cfvz lightwave-$(LWVERSION).tar.gz --exclude='.git*' lightwave
# 'make clean': Remove unneeded files from package.
clean:
rm -f lightwave patchann *~ */*~ */*/*~
FORCE:
The key change in two file are the ServerName and Localhost
I ran this command to disable the default config of apache2
sudo a2dissite 000-default.conf
Then, I ran the following command to enable new config of apche2 for lightwave server:
sudo a2ensite lightwave.conf
After that, in the lightwave/ directory I ran the makefile:
sudo make
The terminal print out this:
gcc -O -DLWDIR=\"/home/physionet/html/lightwave\" -DLWVER=\"0.72\" -DLW_WFDB=\""/usr/local/database http://physionet.org/physiobank/database"\" server/lightwave.c server/cgi.c -o lightwave -lwfdb
mkdir -p /home/physionet/cgi-bin/
install -m 755 lightwave /home/physionet/cgi-bin/
gcc -O -DLWDIR=\"/home/physionet/html/lightwave\" -DLWVER=\"0.72\" -DLW_WFDB=\""/usr/local/database http://physionet.org/physiobank/database"\" server/patchann.c -o /usr/local/bin/patchann -lwfdb
server/patchann.c: In function ‘main’:
server/patchann.c:128:70: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
128 | fprintf(stderr, "%s: can't write output annotation file '%s.%s\n",
| ~^
| |
| char *
server/patchann.c: In function ‘parse_log_header’:
server/patchann.c:196:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
196 | fgets(logtext, sizeof(logtext), stdin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
server/patchann.c:227:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
227 | fgets(logtext, sizeof(logtext), stdin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ -d /ptmp/lw ] || sudo mkdir -p /ptmp/lw
sudo chmod 755 /ptmp/lw
sudo cp -p server/download.html /ptmp/lw
sudo chown ntthong /ptmp/lw
mkdir -p /home/physionet/cgi-bin/
sed s+/usr/local+/usr/local+ <server/lw-scribe | \
sed s+/ptmp/lw+/ptmp/lw+ >/home/physionet/cgi-bin//lw-scribe
chmod 755 /home/physionet/cgi-bin//lw-scribe
rm -f lightwave patchann *~ */*~ */*/*~
mkdir -p /home/physionet/html/lightwave
cp -pr client/* /home/physionet/html/lightwave
rm -f /home/physionet/html/lightwave/lightwave.html
baseurl=`echo "http://localhost/cgi-bin/lightwave" | cut -d/ -f1-3`; \
serverpath=`echo "http://localhost/cgi-bin/lightwave" | cut -d/ -f4-`; \
scribepath=`echo "http://localhost/cgi-bin/lw-scribe" | cut -d/ -f4-`; \
sed "s+'https://physionet.org'+'$baseurl'+" \
<client/js/lightwave.js | \
sed "s+'/cgi-bin/lightwave'+'/$serverpath'+" | \
sed "s+'/cgi-bin/lw-scribe'+'/$scribepath'+" \
>/home/physionet/html/lightwave/js/lightwave.js
sed "s/\[local\]/0.72/" <client/lightwave.html \
>/home/physionet/html/lightwave/index.html
LightWAVE has been installed. If an HTTP server is running on
localhost, run LightWAVE by pointing your web browser to
http://localhost/lightwave/
when I clicked to the link, I got this:

What did I do?
I have install all the prerequisites listed in the Makefile including:
I copied the
lw-apache.conffrom./serverto/etc/apache2/sites-enabled/and here is mylw-apache.conffile after edited:This is my Makefile after edited:
The key change in two file are the
ServerNameandLocalhostI ran this command to disable the default config of apache2
sudo a2dissite 000-default.confThen, I ran the following command to enable new config of apche2 for lightwave server:
sudo a2ensite lightwave.confAfter that, in the
lightwave/directory I ran the makefile:sudo makeThe terminal print out this:
when I clicked to the link, I got this:
