Use location of script to find web-server root
This commit is contained in:
parent
0a7ada489d
commit
2b27ee6569
|
@ -43,11 +43,11 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
|
|||
(define simultaneous-requests #f)
|
||||
|
||||
(define (init)
|
||||
(set! htdocs-dir "web-server/root/htdocs")
|
||||
(set! cgi-bin-dir "web-server/root/cgi-bin")
|
||||
(set! htdocs-dir "root/htdocs")
|
||||
(set! cgi-bin-dir "root/cgi-bin")
|
||||
(set! port "8080")
|
||||
(set! log-file-name "web-server/httpd.log")
|
||||
(set! root "web-server/root")
|
||||
(set! log-file-name "httpd.log")
|
||||
(set! root "root")
|
||||
(set! simultaneous-requests "5"))
|
||||
|
||||
(define get-options
|
||||
|
@ -112,14 +112,16 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
|
|||
|
||||
|
||||
(define (main args)
|
||||
(init)
|
||||
(format #t "reading options: ~s~%" (cdr args))
|
||||
(get-options (cdr args))
|
||||
(cond ((zero? (user-uid))
|
||||
(set-gid (->gid "nobody"))
|
||||
(set-uid (->uid "nobody"))))
|
||||
(with-cwd
|
||||
(file-name-directory (car (command-line)))
|
||||
(init)
|
||||
(format #t "reading options: ~s~%" (cdr args))
|
||||
(get-options (cdr args))
|
||||
(cond ((zero? (user-uid))
|
||||
(set-gid (->gid "nobody"))
|
||||
(set-uid (->uid "nobody"))))
|
||||
|
||||
(format #t "Going to run Webserver with:
|
||||
(format #t "Going to run Webserver with:
|
||||
htdocs-dir: ~a
|
||||
cgi-bin-dir: ~a
|
||||
port: ~a
|
||||
|
@ -127,33 +129,33 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
|
|||
a maximum of ~a simultaneous requests, syslogging activated,
|
||||
and home-dir-handler (public_html) activated.
|
||||
"
|
||||
htdocs-dir
|
||||
cgi-bin-dir
|
||||
port
|
||||
log-file-name
|
||||
simultaneous-requests)
|
||||
htdocs-dir
|
||||
cgi-bin-dir
|
||||
port
|
||||
log-file-name
|
||||
simultaneous-requests)
|
||||
|
||||
(httpd (make-httpd-options
|
||||
with-port port
|
||||
with-root-directory (cwd)
|
||||
with-simultaneous-requests simultaneous-requests
|
||||
with-syslog? #t
|
||||
with-log-file log-file-name
|
||||
with-request-handler
|
||||
(alist-path-dispatcher
|
||||
(list (cons "h" (home-dir-handler "public_html"))
|
||||
(cons "seval" seval-handler)
|
||||
;; You may want to adapt this to your site.
|
||||
(cons "man" (rman-handler 'man
|
||||
'nroff
|
||||
"/usr/bin/rman"
|
||||
"/usr/bin/zcat"
|
||||
#f "man?%s(%s)"
|
||||
"Generated by rman-gateway"))
|
||||
(cons "info" (info-handler #f #f #f
|
||||
"Generated by info-gateway"))
|
||||
(cons "cgi-bin" (cgi-handler cgi-bin-dir)))
|
||||
(rooted-file-or-directory-handler htdocs-dir)))))
|
||||
(httpd (make-httpd-options
|
||||
with-port port
|
||||
with-root-directory (cwd)
|
||||
with-simultaneous-requests simultaneous-requests
|
||||
with-syslog? #t
|
||||
with-log-file log-file-name
|
||||
with-request-handler
|
||||
(alist-path-dispatcher
|
||||
(list (cons "h" (home-dir-handler "public_html"))
|
||||
(cons "seval" seval-handler)
|
||||
;; You may want to adapt this to your site.
|
||||
(cons "man" (rman-handler 'man
|
||||
'nroff
|
||||
"/usr/bin/rman"
|
||||
"/usr/bin/zcat"
|
||||
#f "man?%s(%s)"
|
||||
"Generated by rman-gateway"))
|
||||
(cons "info" (info-handler #f #f #f
|
||||
"Generated by info-gateway"))
|
||||
(cons "cgi-bin" (cgi-handler cgi-bin-dir)))
|
||||
(rooted-file-or-directory-handler htdocs-dir))))))
|
||||
))
|
||||
|
||||
;; EOF
|
||||
|
|
|
@ -53,13 +53,13 @@ exec scsh -lel sunet-2.1/load.scm -lel ssax/load.scm -dm -o surflet-server -e ma
|
|||
(define simultaneous-requests #f)
|
||||
|
||||
(define (init)
|
||||
(set! htdocs-dir "./web-server/root/htdocs")
|
||||
(set! images-dir "./web-server/root/img")
|
||||
(set! htdocs-dir "root/htdocs")
|
||||
(set! images-dir "root/img")
|
||||
; (set! cgi-bin-dir "./web-server/root/cgi-bin")
|
||||
(set! port "8008")
|
||||
(set! log-file-name "./web-server/httpd.log")
|
||||
(set! root "./web-server/root")
|
||||
(set! surflet-dir "./web-server/root/surflets")
|
||||
(set! log-file-name "httpd.log")
|
||||
(set! root "root")
|
||||
(set! surflet-dir "root/surflets")
|
||||
(set! simultaneous-requests "5"))
|
||||
|
||||
(define (normalize-options)
|
||||
|
@ -144,14 +144,16 @@ exec scsh -lel sunet-2.1/load.scm -lel ssax/load.scm -dm -o surflet-server -e ma
|
|||
(main '(main))))
|
||||
|
||||
(define (main args)
|
||||
(init)
|
||||
(format #t "reading options: ~s~%" (cdr args))
|
||||
(get-options (cdr args))
|
||||
(cond ((zero? (user-uid))
|
||||
(set-gid (->gid "nobody"))
|
||||
(set-uid (->uid "nobody"))))
|
||||
(with-cwd
|
||||
(file-name-directory (car (command-line)))
|
||||
(init)
|
||||
(format #t "reading options: ~s~%" (cdr args))
|
||||
(get-options (cdr args))
|
||||
(cond ((zero? (user-uid))
|
||||
(set-gid (->gid "nobody"))
|
||||
(set-uid (->uid "nobody"))))
|
||||
|
||||
(format #t "Going to run SUrflet server with:
|
||||
(format #t "Going to run SUrflet server with:
|
||||
htdocs-dir: ~a
|
||||
surflet-dir: ~a
|
||||
images-dir: ~a
|
||||
|
@ -162,45 +164,45 @@ exec scsh -lel sunet-2.1/load.scm -lel ssax/load.scm -dm -o surflet-server -e ma
|
|||
|
||||
NOTE: This is the SUrflet server. It does not support cgi.
|
||||
"
|
||||
htdocs-dir
|
||||
surflet-dir
|
||||
images-dir
|
||||
port
|
||||
log-file-name
|
||||
simultaneous-requests)
|
||||
htdocs-dir
|
||||
surflet-dir
|
||||
images-dir
|
||||
port
|
||||
log-file-name
|
||||
simultaneous-requests)
|
||||
|
||||
(httpd (make-httpd-options
|
||||
with-port port
|
||||
with-root-directory (cwd)
|
||||
with-simultaneous-requests simultaneous-requests
|
||||
with-syslog? #t
|
||||
with-log-file log-file-name
|
||||
;; The following settings are made to avoid dns lookups.
|
||||
with-reported-port port
|
||||
with-fqdn "localhost"
|
||||
with-resolve-ips? #f
|
||||
with-request-handler
|
||||
(alist-path-dispatcher
|
||||
(list (cons "h" (home-dir-handler "public_html"))
|
||||
(httpd (make-httpd-options
|
||||
with-port port
|
||||
with-root-directory (cwd)
|
||||
with-simultaneous-requests simultaneous-requests
|
||||
with-syslog? #t
|
||||
with-log-file log-file-name
|
||||
;; The following settings are made to avoid dns lookups.
|
||||
with-reported-port port
|
||||
with-fqdn "localhost"
|
||||
with-resolve-ips? #f
|
||||
with-request-handler
|
||||
(alist-path-dispatcher
|
||||
(list (cons "h" (home-dir-handler "public_html"))
|
||||
; (cons "seval" seval-handler)
|
||||
; (cons "man" (rman-handler #f "man?%s(%s)"
|
||||
; "Generated by rman-gateway"))
|
||||
; (cons "info" (info-handler #f #f #f
|
||||
; "Generated by info-gateway"))
|
||||
; (cons "cgi-bin" (cgi-handler cgi-bin-dir))
|
||||
(cons "source" (rooted-file-or-directory-handler
|
||||
surflet-dir
|
||||
(with-file-name->content-type
|
||||
(lambda (file-name)
|
||||
(if (string-ci=? (file-name-extension file-name)
|
||||
".scm")
|
||||
"text/plain"))
|
||||
(make-file-directory-options))))
|
||||
(cons "img" (rooted-file-handler images-dir))
|
||||
(cons "surflet" (surflet-handler
|
||||
(with-surflet-path surflet-dir))))
|
||||
(rooted-file-or-directory-handler htdocs-dir))))
|
||||
)
|
||||
(cons "source" (rooted-file-or-directory-handler
|
||||
surflet-dir
|
||||
(with-file-name->content-type
|
||||
(lambda (file-name)
|
||||
(if (string-ci=? (file-name-extension file-name)
|
||||
".scm")
|
||||
"text/plain"))
|
||||
(make-file-directory-options))))
|
||||
(cons "img" (rooted-file-handler images-dir))
|
||||
(cons "surflet" (surflet-handler
|
||||
(with-surflet-path surflet-dir))))
|
||||
(rooted-file-or-directory-handler htdocs-dir))))
|
||||
))
|
||||
))
|
||||
;; EOF
|
||||
|
||||
|
|
|
@ -37,11 +37,11 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
|
|||
(define root #f)
|
||||
|
||||
(define (init)
|
||||
(set! htdocs-dir "web-server/root/htdocs")
|
||||
(set! cgi-bin-dir "web-server/root/cgi-bin")
|
||||
(set! htdocs-dir "root/htdocs")
|
||||
(set! cgi-bin-dir "root/cgi-bin")
|
||||
(set! port "8080")
|
||||
(set! log-file-name "web-server/httpd.log")
|
||||
(set! root "web-server/root"))
|
||||
(set! log-file-name "httpd.log")
|
||||
(set! root "root"))
|
||||
|
||||
(define get-options
|
||||
(let* ((unknown-option-error
|
||||
|
@ -103,35 +103,37 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
|
|||
(set-uid (->uid "nobody")))))
|
||||
|
||||
(define (main args)
|
||||
(init)
|
||||
(format #t "reading options: ~s~%" (cdr args))
|
||||
(get-options (cdr args))
|
||||
(with-cwd
|
||||
(file-name-directory (car (command-line)))
|
||||
(init)
|
||||
(format #t "reading options: ~s~%" (cdr args))
|
||||
(get-options (cdr args))
|
||||
|
||||
(format #t "Going to run Webserver with:
|
||||
(format #t "Going to run Webserver with:
|
||||
htdocs-dir: ~a
|
||||
cgi-bin-dir: ~a
|
||||
port: ~a
|
||||
log-file-name: ~a
|
||||
syslogging activated.
|
||||
"
|
||||
htdocs-dir
|
||||
cgi-bin-dir
|
||||
port
|
||||
log-file-name)
|
||||
htdocs-dir
|
||||
cgi-bin-dir
|
||||
port
|
||||
log-file-name)
|
||||
|
||||
(httpd (make-httpd-options
|
||||
with-port port
|
||||
with-root-directory (cwd)
|
||||
with-syslog? #t
|
||||
with-log-file log-file-name
|
||||
with-post-bind-thunk become-nobody-if-root
|
||||
with-request-handler
|
||||
(alist-path-dispatcher
|
||||
(list (cons "cgi-bin" (cgi-handler cgi-bin-dir))
|
||||
(cons "seval" seval-handler))
|
||||
(tilde-home-dir-handler "public_html"
|
||||
(rooted-file-or-directory-handler
|
||||
htdocs-dir))))))
|
||||
(httpd (make-httpd-options
|
||||
with-port port
|
||||
with-root-directory (cwd)
|
||||
with-syslog? #t
|
||||
with-log-file log-file-name
|
||||
with-post-bind-thunk become-nobody-if-root
|
||||
with-request-handler
|
||||
(alist-path-dispatcher
|
||||
(list (cons "cgi-bin" (cgi-handler cgi-bin-dir))
|
||||
(cons "seval" seval-handler))
|
||||
(tilde-home-dir-handler "public_html"
|
||||
(rooted-file-or-directory-handler
|
||||
htdocs-dir)))))))
|
||||
))
|
||||
;; EOF
|
||||
|
||||
|
|
Loading…
Reference in New Issue