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 simultaneous-requests #f)
|
||||||
|
|
||||||
(define (init)
|
(define (init)
|
||||||
(set! htdocs-dir "web-server/root/htdocs")
|
(set! htdocs-dir "root/htdocs")
|
||||||
(set! cgi-bin-dir "web-server/root/cgi-bin")
|
(set! cgi-bin-dir "root/cgi-bin")
|
||||||
(set! port "8080")
|
(set! port "8080")
|
||||||
(set! log-file-name "web-server/httpd.log")
|
(set! log-file-name "httpd.log")
|
||||||
(set! root "web-server/root")
|
(set! root "root")
|
||||||
(set! simultaneous-requests "5"))
|
(set! simultaneous-requests "5"))
|
||||||
|
|
||||||
(define get-options
|
(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)
|
(define (main args)
|
||||||
(init)
|
(with-cwd
|
||||||
(format #t "reading options: ~s~%" (cdr args))
|
(file-name-directory (car (command-line)))
|
||||||
(get-options (cdr args))
|
(init)
|
||||||
(cond ((zero? (user-uid))
|
(format #t "reading options: ~s~%" (cdr args))
|
||||||
(set-gid (->gid "nobody"))
|
(get-options (cdr args))
|
||||||
(set-uid (->uid "nobody"))))
|
(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
|
htdocs-dir: ~a
|
||||||
cgi-bin-dir: ~a
|
cgi-bin-dir: ~a
|
||||||
port: ~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,
|
a maximum of ~a simultaneous requests, syslogging activated,
|
||||||
and home-dir-handler (public_html) activated.
|
and home-dir-handler (public_html) activated.
|
||||||
"
|
"
|
||||||
htdocs-dir
|
htdocs-dir
|
||||||
cgi-bin-dir
|
cgi-bin-dir
|
||||||
port
|
port
|
||||||
log-file-name
|
log-file-name
|
||||||
simultaneous-requests)
|
simultaneous-requests)
|
||||||
|
|
||||||
(httpd (make-httpd-options
|
(httpd (make-httpd-options
|
||||||
with-port port
|
with-port port
|
||||||
with-root-directory (cwd)
|
with-root-directory (cwd)
|
||||||
with-simultaneous-requests simultaneous-requests
|
with-simultaneous-requests simultaneous-requests
|
||||||
with-syslog? #t
|
with-syslog? #t
|
||||||
with-log-file log-file-name
|
with-log-file log-file-name
|
||||||
with-request-handler
|
with-request-handler
|
||||||
(alist-path-dispatcher
|
(alist-path-dispatcher
|
||||||
(list (cons "h" (home-dir-handler "public_html"))
|
(list (cons "h" (home-dir-handler "public_html"))
|
||||||
(cons "seval" seval-handler)
|
(cons "seval" seval-handler)
|
||||||
;; You may want to adapt this to your site.
|
;; You may want to adapt this to your site.
|
||||||
(cons "man" (rman-handler 'man
|
(cons "man" (rman-handler 'man
|
||||||
'nroff
|
'nroff
|
||||||
"/usr/bin/rman"
|
"/usr/bin/rman"
|
||||||
"/usr/bin/zcat"
|
"/usr/bin/zcat"
|
||||||
#f "man?%s(%s)"
|
#f "man?%s(%s)"
|
||||||
"Generated by rman-gateway"))
|
"Generated by rman-gateway"))
|
||||||
(cons "info" (info-handler #f #f #f
|
(cons "info" (info-handler #f #f #f
|
||||||
"Generated by info-gateway"))
|
"Generated by info-gateway"))
|
||||||
(cons "cgi-bin" (cgi-handler cgi-bin-dir)))
|
(cons "cgi-bin" (cgi-handler cgi-bin-dir)))
|
||||||
(rooted-file-or-directory-handler htdocs-dir)))))
|
(rooted-file-or-directory-handler htdocs-dir))))))
|
||||||
))
|
))
|
||||||
|
|
||||||
;; EOF
|
;; 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 simultaneous-requests #f)
|
||||||
|
|
||||||
(define (init)
|
(define (init)
|
||||||
(set! htdocs-dir "./web-server/root/htdocs")
|
(set! htdocs-dir "root/htdocs")
|
||||||
(set! images-dir "./web-server/root/img")
|
(set! images-dir "root/img")
|
||||||
; (set! cgi-bin-dir "./web-server/root/cgi-bin")
|
; (set! cgi-bin-dir "./web-server/root/cgi-bin")
|
||||||
(set! port "8008")
|
(set! port "8008")
|
||||||
(set! log-file-name "./web-server/httpd.log")
|
(set! log-file-name "httpd.log")
|
||||||
(set! root "./web-server/root")
|
(set! root "root")
|
||||||
(set! surflet-dir "./web-server/root/surflets")
|
(set! surflet-dir "root/surflets")
|
||||||
(set! simultaneous-requests "5"))
|
(set! simultaneous-requests "5"))
|
||||||
|
|
||||||
(define (normalize-options)
|
(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))))
|
(main '(main))))
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
(init)
|
(with-cwd
|
||||||
(format #t "reading options: ~s~%" (cdr args))
|
(file-name-directory (car (command-line)))
|
||||||
(get-options (cdr args))
|
(init)
|
||||||
(cond ((zero? (user-uid))
|
(format #t "reading options: ~s~%" (cdr args))
|
||||||
(set-gid (->gid "nobody"))
|
(get-options (cdr args))
|
||||||
(set-uid (->uid "nobody"))))
|
(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
|
htdocs-dir: ~a
|
||||||
surflet-dir: ~a
|
surflet-dir: ~a
|
||||||
images-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.
|
NOTE: This is the SUrflet server. It does not support cgi.
|
||||||
"
|
"
|
||||||
htdocs-dir
|
htdocs-dir
|
||||||
surflet-dir
|
surflet-dir
|
||||||
images-dir
|
images-dir
|
||||||
port
|
port
|
||||||
log-file-name
|
log-file-name
|
||||||
simultaneous-requests)
|
simultaneous-requests)
|
||||||
|
|
||||||
(httpd (make-httpd-options
|
(httpd (make-httpd-options
|
||||||
with-port port
|
with-port port
|
||||||
with-root-directory (cwd)
|
with-root-directory (cwd)
|
||||||
with-simultaneous-requests simultaneous-requests
|
with-simultaneous-requests simultaneous-requests
|
||||||
with-syslog? #t
|
with-syslog? #t
|
||||||
with-log-file log-file-name
|
with-log-file log-file-name
|
||||||
;; The following settings are made to avoid dns lookups.
|
;; The following settings are made to avoid dns lookups.
|
||||||
with-reported-port port
|
with-reported-port port
|
||||||
with-fqdn "localhost"
|
with-fqdn "localhost"
|
||||||
with-resolve-ips? #f
|
with-resolve-ips? #f
|
||||||
with-request-handler
|
with-request-handler
|
||||||
(alist-path-dispatcher
|
(alist-path-dispatcher
|
||||||
(list (cons "h" (home-dir-handler "public_html"))
|
(list (cons "h" (home-dir-handler "public_html"))
|
||||||
; (cons "seval" seval-handler)
|
; (cons "seval" seval-handler)
|
||||||
; (cons "man" (rman-handler #f "man?%s(%s)"
|
; (cons "man" (rman-handler #f "man?%s(%s)"
|
||||||
; "Generated by rman-gateway"))
|
; "Generated by rman-gateway"))
|
||||||
; (cons "info" (info-handler #f #f #f
|
; (cons "info" (info-handler #f #f #f
|
||||||
; "Generated by info-gateway"))
|
; "Generated by info-gateway"))
|
||||||
; (cons "cgi-bin" (cgi-handler cgi-bin-dir))
|
; (cons "cgi-bin" (cgi-handler cgi-bin-dir))
|
||||||
(cons "source" (rooted-file-or-directory-handler
|
(cons "source" (rooted-file-or-directory-handler
|
||||||
surflet-dir
|
surflet-dir
|
||||||
(with-file-name->content-type
|
(with-file-name->content-type
|
||||||
(lambda (file-name)
|
(lambda (file-name)
|
||||||
(if (string-ci=? (file-name-extension file-name)
|
(if (string-ci=? (file-name-extension file-name)
|
||||||
".scm")
|
".scm")
|
||||||
"text/plain"))
|
"text/plain"))
|
||||||
(make-file-directory-options))))
|
(make-file-directory-options))))
|
||||||
(cons "img" (rooted-file-handler images-dir))
|
(cons "img" (rooted-file-handler images-dir))
|
||||||
(cons "surflet" (surflet-handler
|
(cons "surflet" (surflet-handler
|
||||||
(with-surflet-path surflet-dir))))
|
(with-surflet-path surflet-dir))))
|
||||||
(rooted-file-or-directory-handler htdocs-dir))))
|
(rooted-file-or-directory-handler htdocs-dir))))
|
||||||
)
|
))
|
||||||
))
|
))
|
||||||
;; EOF
|
;; 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 root #f)
|
||||||
|
|
||||||
(define (init)
|
(define (init)
|
||||||
(set! htdocs-dir "web-server/root/htdocs")
|
(set! htdocs-dir "root/htdocs")
|
||||||
(set! cgi-bin-dir "web-server/root/cgi-bin")
|
(set! cgi-bin-dir "root/cgi-bin")
|
||||||
(set! port "8080")
|
(set! port "8080")
|
||||||
(set! log-file-name "web-server/httpd.log")
|
(set! log-file-name "httpd.log")
|
||||||
(set! root "web-server/root"))
|
(set! root "root"))
|
||||||
|
|
||||||
(define get-options
|
(define get-options
|
||||||
(let* ((unknown-option-error
|
(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")))))
|
(set-uid (->uid "nobody")))))
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
(init)
|
(with-cwd
|
||||||
(format #t "reading options: ~s~%" (cdr args))
|
(file-name-directory (car (command-line)))
|
||||||
(get-options (cdr args))
|
(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
|
htdocs-dir: ~a
|
||||||
cgi-bin-dir: ~a
|
cgi-bin-dir: ~a
|
||||||
port: ~a
|
port: ~a
|
||||||
log-file-name: ~a
|
log-file-name: ~a
|
||||||
syslogging activated.
|
syslogging activated.
|
||||||
"
|
"
|
||||||
htdocs-dir
|
htdocs-dir
|
||||||
cgi-bin-dir
|
cgi-bin-dir
|
||||||
port
|
port
|
||||||
log-file-name)
|
log-file-name)
|
||||||
|
|
||||||
(httpd (make-httpd-options
|
(httpd (make-httpd-options
|
||||||
with-port port
|
with-port port
|
||||||
with-root-directory (cwd)
|
with-root-directory (cwd)
|
||||||
with-syslog? #t
|
with-syslog? #t
|
||||||
with-log-file log-file-name
|
with-log-file log-file-name
|
||||||
with-post-bind-thunk become-nobody-if-root
|
with-post-bind-thunk become-nobody-if-root
|
||||||
with-request-handler
|
with-request-handler
|
||||||
(alist-path-dispatcher
|
(alist-path-dispatcher
|
||||||
(list (cons "cgi-bin" (cgi-handler cgi-bin-dir))
|
(list (cons "cgi-bin" (cgi-handler cgi-bin-dir))
|
||||||
(cons "seval" seval-handler))
|
(cons "seval" seval-handler))
|
||||||
(tilde-home-dir-handler "public_html"
|
(tilde-home-dir-handler "public_html"
|
||||||
(rooted-file-or-directory-handler
|
(rooted-file-or-directory-handler
|
||||||
htdocs-dir))))))
|
htdocs-dir)))))))
|
||||||
))
|
))
|
||||||
;; EOF
|
;; EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue