1 Star 0 Fork 1

XiaNengQi / hapi-server

forked from rosiky9527 / hapi-server 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

hapi-server

项目介绍

小程序后台服务

软件架构

主要采用 hapi+mysql搭建的接口服务(用hapi-swagger提供了接口文档) 另外采用nginx代理static文件夹下的静态资源(这块资源后期会新建web项目,打包后拷进static文件夹)

nginx配置记录start

#user nobody; worker_processes 1;

#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;

#pid logs/nginx.pid;

events { worker_connections 1024; }

http { include mime.types; default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       80;
    server_name  127.0.0.1;
	
    #charset koi8-r;

    #access_log  logs/host.access.log  main;
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$     
    {
     root D:\hapi-server\static;
     #expires 30d;
	 expires  -1;
    }
    location ~ .*\.(css)?$
    {
     root D:\hapi-server\static;
     #expires 1h;
	 expires  -1;
    }
    location ~ .*\.(js)?$
    {
     root D:\hapi-server\static;
     #expires 1h;
	 expires  -1;
    }
	location ~ .*\.(html|htm)?$
    {
     root D:\hapi-server\static;
     #expires 1h;
	 expires  -1;
	 error_page 404 /404.html;
    }

    location / {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       #proxy_set_header X-Nginx-Proxy true;
       proxy_set_header Connection "";
       proxy_pass http://localhost:3000;
    }
	
	
    error_page  404              /404.html;
	
	location = /404.html {
        root   D:\hapi-server\static;
    }
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   D:\hapi-server\static;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}


# HTTPS server
#
#server {
#    listen       443 ssl;
#    server_name  localhost;

#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_cache    shared:SSL:1m;
#    ssl_session_timeout  5m;

#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers  on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

}

nginx配置记录 end

nginx疑问说明

nginx这边 很奇怪,大概看了下,error.log 错在请求的静态文件路。我目前配置的静态文件路径是D:\hapi-server\static,但是/documentation有引入nodemodules下的文件
D:\hapi-server\node_modules\hapi-swagger\public\swaggerui,这就导致找不到文件,这里先放着,访问3000也能访问,而且对nginx配置还不是很了解,后期再优化。
而且,mode_modules里,hapi-swagger下,大概看了下,貌似插件自己建了个服务器??

hapi api 太jb难找了 git上勉强down了一份 在项目根目录 API.md

hapi-swagger-api.md 新增的hapi-swagger的api

空文件

简介

小程序后台服务 展开 收起
NodeJS
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
NodeJS
1
https://gitee.com/xianengqi/hapi-server.git
git@gitee.com:xianengqi/hapi-server.git
xianengqi
hapi-server
hapi-server
master

搜索帮助