Goahead 编译

Goahead

目录说明

Makefile #顶层Makefile,可以自动检测当前运行平台的环境,并调用projects的mk
projects #子层的Makefile,有各个平台的

#可以看到直接make 输出如下
make --no-print-directory -f projects/goahead-linux-default.mk all

# 安装
sudo make install

Ubuntu编译

make

make
sudo make install

selfkey处理

reallin@ubuntu:/work/goahead/goahead-5.0.1$ sudo goahead -v --home /etc/goahead /var/www/goahead
goahead: 0: Unable to read key self.key
goahead: 0: Cannot initialize server. Exiting.

sudo cp ./build/linux-x64-default/bin/self.key /etc/goahead
sudo cp ./build/linux-x64-default/bin/self.crt  /etc/goahead

测试

#./goahead -v --home 配置文件路径 文档路径 绑定IP:监听端口
#./goahead -v --home /etc/goahead /var/www/goahead 0.0.0.0:8888
sudo goahead -v --home /etc/goahead /var/www/goahead


# 下面是运行结果
goahead: 2: Configuration for Embedthis GoAhead Community Edition                           
goahead: 2: ---------------------------------------------                                   
goahead: 2: Version:            5.0.1                                                       
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: ---------------------------------------------                                   
goahead: 2: Started http://*:80                                                             
goahead: 2: Started https://*:443                                                           

具体的install目录

ls /etc/goahead
auth.txt  route.txt  self.crt  self.key

ls /var/www/goahead
favicon.ico  index.html  # 这个就是网页了

交叉编译

# 如果有错误提示 undefined reference to `__stack_chk_fail'  加上这个选项-fno-stack-protector
make CC=arm-linux-gcc LD=arm-linux-ld CFLAGS=-fno-stack-protector

方便测试

  1. cd build/linux-x64-default/bin
  2. cp ../../../src/auth.txt ./
  3. cp ../../../src/route.txt ./
  4. 新建一个myweb文件夹存网页
  5. sudo ./goahead -v ./myweb/

参考

posted @ 2019-11-30 15:20  zongzi10010  阅读(661)  评论(0编辑  收藏  举报