基本內容
- 設置網頁目錄
- 開啟SSL
- 設置PEM檔案 (沒有提供key 設置)
- 設置index-file,當指輸入IP 到瀏覽器時開網頁時,會自動找index.html 開啟
- 設置rewrite module (可以轉頁)
- 網址/hello 跳到 /index.html
server.document-root = "/srv/www/build" server.port = 443 mimetype.assign = ( ".html" => "." ) ssl.engine = "enable" ssl.pemfile = "/opt/lighttpd_arm/sbin/mcm_server.pem" server.modules = ( "mod_rewrite" ) index-file.names = ( "index.html" ) url.rewrite-once = ( "/login" => "/index.html", "/deviceInfo" => "/index.html", "/deviceSetting" => "/index.html", "/captureData" => "/index.html", "/historyData" => "/index.html", "/conditionData" => "/index.html", "/missionMgr" => "/index.html", "/accountMgr" => "/index.html", "/changePassword" => "/index.html" ) |
lighttpd -D -f lighttpd.conf #讀取設置檔案並啟動web lighttpd -t -f lighttpd.conf #檢查conf 檔案文法 |
init 腳本
#!/bin/sh ### BEGIN INIT INFO # Provides: lighted # Required-Start: $syslog $remote_fs $network # Required-Stop: $syslog $remote_fs $network # Should-Start: fam # Should-Stop: fam # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start the lighted web server. ### END INIT INFO PATH= /sbin : /bin : /usr/sbin : /usr/bin DAEMON= /usr/sbin/lighttpd NAME=lighttpd DESC= "web server" PIDFILE= /var/run/ $NAME.pid SCRIPTNAME= /etc/init .d/$NAME DAEMON_OPTS= "-f /etc/lighttpd/lighttpd.conf" test -x $DAEMON || exit 0 set -e check_syntax() { $DAEMON -t $DAEMON_OPTS > /dev/null || exit $? } if [ "$1" != status ]; then # be sure there is a /var/run/lighttpd, even with tmpfs mkdir --mode 750 --parents /var/run/lighttpd chown www-data:www-data /var/run/lighttpd fi . /lib/lsb/init-functions case "$1" in start) check_syntax log_daemon_msg "Starting $DESC" $NAME if ! start-stop-daemon --start --oknodo --quiet \ --pidfile $PIDFILE -- exec $DAEMON -- $DAEMON_OPTS then log_end_msg 1 else log_end_msg 0 fi ;; stop) log_daemon_msg "Stopping $DESC" $NAME if start-stop-daemon --stop --retry 30 --oknodo --quiet \ --pidfile $PIDFILE -- exec $DAEMON then rm -f $PIDFILE log_end_msg 0 else log_end_msg 1 fi ;; reload|force-reload) check_syntax log_daemon_msg "Reloading $DESC configuration" $NAME if start-stop-daemon --stop --signal INT --quiet \ --pidfile $PIDFILE -- exec $DAEMON then rm $PIDFILE if start-stop-daemon --start --quiet \ --pidfile $PIDFILE -- exec $DAEMON -- $DAEMON_OPTS ; then log_end_msg 0 else log_end_msg 1 fi else log_end_msg 1 fi ;; reopen-logs) log_daemon_msg "Reopening $DESC logs" $NAME if start-stop-daemon --stop --signal HUP --oknodo --quiet \ --pidfile $PIDFILE -- exec $DAEMON then log_end_msg 0 else log_end_msg 1 fi ;; restart) check_syntax $0 stop $0 start ;; status) status_of_proc -p "$PIDFILE" "$DAEMON" lighttpd && exit 0 || exit $? ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 exit 1 ;; esac exit 0 |
沒有留言:
張貼留言