嵌入式web-server goahead 安装篇


官网下载源码

https://www.embedthis.com/goahead/

解压到指定目录

azan@ubuntu:~/nwjzq/nwddu$ tar zxvf goahead-src.tgz -C ./

编译

azan@ubuntu:~/nwjzq/nwddu/goahead-4.1.3$ make
make --no-print-directory -f projects/goahead-linux-default.mk all
      [Info] Use make SHOW=1 to trace executed commands.
      [Copy] build/linux-x64-default/inc/osdep.h
      [Copy] build/linux-x64-default/inc/embedtls.h
      [Copy] build/linux-x64-default/inc/mbedtls.h
   [Compile] build/linux-x64-default/obj/mbedtls.o
      [Link] build/linux-x64-default/bin/libmbedtls.a
      [Copy] build/linux-x64-default/inc/goahead.h
   [Compile] build/linux-x64-default/obj/goahead-mbedtls.o
      [Link] build/linux-x64-default/bin/libgoahead-mbedtls.a
      [Copy] build/linux-x64-default/inc/js.h
   [Compile] build/linux-x64-default/obj/action.o
   [Compile] build/linux-x64-default/obj/alloc.o
   [Compile] build/linux-x64-default/obj/auth.o
   [Compile] build/linux-x64-default/obj/cgi.o
   [Compile] build/linux-x64-default/obj/crypt.o
   [Compile] build/linux-x64-default/obj/file.o
   [Compile] build/linux-x64-default/obj/fs.o
   [Compile] build/linux-x64-default/obj/http.o
   [Compile] build/linux-x64-default/obj/js.o
   [Compile] build/linux-x64-default/obj/jst.o
   [Compile] build/linux-x64-default/obj/options.o
   [Compile] build/linux-x64-default/obj/osdep.o
   [Compile] build/linux-x64-default/obj/rom.o
   [Compile] build/linux-x64-default/obj/route.o
   [Compile] build/linux-x64-default/obj/runtime.o
   [Compile] build/linux-x64-default/obj/socket.o
   [Compile] build/linux-x64-default/obj/time.o
   [Compile] build/linux-x64-default/obj/upload.o
      [Link] build/linux-x64-default/bin/libgo.so
      [Copy] build/linux-x64-default/bin
   [Compile] build/linux-x64-default/obj/goahead.o
      [Link] build/linux-x64-default/bin/goahead
   [Compile] build/linux-x64-default/obj/test.o
      [Link] build/linux-x64-default/bin/goahead-test
   [Compile] build/linux-x64-default/obj/gopass.o
      [Link] build/linux-x64-default/bin/gopass

You can now install via "sudo make  install" or run GoAhead via: "sudo make run"
To run locally, put linux-x64-default/bin in your path

此时执行sodu make install 会报错,需要copy密钥和证书

./goahead -v --home 配置文件路径 网页文件路径 绑定IP:监听端口

./goahead -v --home /etc/goahead /var/www/goahead 127.0.0.1:8080

azan@ubuntu:~/nwjzq/nwddu/goahead-4.1.3$ sudo make install
make --no-print-directory -f projects/goahead-linux-default.mk install
cp: target '/etc/goahead/self.*' is not a directory

You can now run via "sudo goahead -v --home /etc/goahead /var/www/goahead"

azan@ubuntu:~/nwjzq/nwddu/goahead-4.1.3$ sudo cp src/self.* /etc/goahead/
azan@ubuntu:~/nwjzq/nwddu/goahead-4.1.3$ sudo make install
make --no-print-directory -f projects/goahead-linux-default.mk install
cp: target '/etc/goahead/self.key' is not a directory

You can now run via "sudo goahead -v --home /etc/goahead /var/www/goahead"
azan@ubuntu:~/nwjzq/nwddu/goahead-4.1.3$ sudo goahead -v --home /etc/goahead /var/www/goahead
goahead: 2: Configuration for Embedthis GoAhead Community Edition
goahead: 2: ---------------------------------------------
goahead: 2: Version:            4.1.3
goahead: 2: BuildType:          Debug
goahead: 2: CPU:                x64
goahead: 2: OS:                 linux
goahead: 2: Host:               127.0.1.1
goahead: 2: Directory:          /etc/goahead
goahead: 2: Documents:          /var/www/goahead
goahead: 2: Configure:          me -d -q -platform linux-x86-default -configure . -gen make
goahead: 2: ---------------------------------------------

至此web-server goahead在虚拟机Linux里安装完毕,测试下结果,打开浏览器输入http://127.0.1.1/index.html

跳出Congratulations! The server is up and running.页面提示成功。