跳转到主要内容
通用技术,上课易!

主导航

  • 首页
  • (苏)技术与设计1
  • (苏)技术与设计2
  • App Inventor 2项目
  • 树莓派项目
  • OTTO 项目
User account menu
  • 登录

面包屑

  1. 首页
  2. App Inventor 2离线版
  3. 三、离线服务器增强

win 64下使用nginx为App Inventor 2 离线服务器做反向代理服务。

由 FsTy, 15 三月, 2017

App Inventor 2 离线服务器作为一个网站多用户使用的时候,有一个潜在的危险: /_ah/admin是公开访问的,所以我们需要一个代理服务器,屏蔽/_ah/admin,并且可以有针对性的提供一些其他服务。

一、下载文件(php 和 RunHiddenConsole 为将来准备):

php7 : http://windows.php.net/download  VC14 x64 Thread Safe    http://windows.php.net/downloads/releases/php-7.1.2-Win32-VC14-x64.zip   (可选)

vc14: https://www.microsoft.com/zh-CN/download/details.aspx?id=48145 (vcruntime14)(可选)

RunHiddenConsole: http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip (可选)

          Nginx-GUI-Administrator   https://sourceforge.net/projects/nginxgui/files/latest/download  (必须)

nginx: http://nginx.org/en/download.html  Stable version   http://nginx.org/download/nginx-1.10.3.zip(必须)

 

二、rundev.bat修改下

 @echo off  
echo "Starting App Inventor 2..." 
cd %~dp0
".\jdk\jre7\bin\java" -cp ".\AppEngine\lib\appengine-tools-api.jar"  com.google.appengine.tools.KickStart  com.google.appengine.tools.development.DevAppServerMain %*  --port=8888 --disable_update_check --address=127.0.0.1 Devserver

三、nginx和php解压到ai2server目录。

三、修改nginx\conf\nginx.conf 文件,不转发/_ah/admin目录。

     


#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;

   server_tokens off; # 不发送版本号--> 新增

  client_max_body_size 1280M; #新增

    #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  ai2.fsyz.net;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root   html;

        location / {
            
            proxy_pass http://127.0.0.1:8888/;
            proxy_read_timeout 300;
            proxy_connect_timeout 300;
            proxy_redirect     off;

            ##rewrite /dashboard/(.*) /$1 break;
            ##rewrite ^/dashboard$ /dashboard/ permanent;

            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_set_header   Host              $http_host;
            proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;


            index  index.html index.htm;
        }

    location /_ah/admin {
            
            index  index.html index.htm;
        }
    location /_db {
            
            index  index.php index.html index.htm;
        }

    location /passmail {
            
            index  index.php;
        }

      location  /mysql {
            root   html;
            index  index.php;
        }


        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # 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$ {
            
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$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;
        #}
    }

    
}
 

四、运行nginx目录下nginxGUI.exe,点击start按钮。应该就可以看到效果了。

五、自己对应修改php\php.ini 网上很多资料

六、run_nginx_php.bat

@ECHO OFF

cd %~dp0
ECHO Starting PHP FastCGI...
set PHP_FCGI_MAX_REQUESTS=100
RunHiddenConsole.exe php\php-cgi.exe  -b 127.0.0.1:9000 -c php\php.ini

echo Starting nginx...
RunHiddenConsole nginx\nginx.exe -p nginx


ping 127.0.0.1 -n 1>NUL
echo .
echo .
echo .
ping 127.0.0.1 >NUL

七、stop_nginx_php.bat

@ECHO OFF
taskkill /f /IM nginx.exe
taskkill /f /IM php-cgi.exe
EXIT

本站提供的个人修改版已经自带nginx和php : https://gte.fsyz.net/node/1878

  • 登录或注册以发表评论
  • 101 次浏览

书籍遍历链接: win 64下使用nginx为App Inventor 2 离线服务器做反向代理服务。

  • war\WEB-INF\appengine-web.xml相关设置
  • 向上
  • 修改App Inventor 2源码,5M<上传,5M<编译<10M

Book navigation

  • AI2(App Inventor 2)离线版服务器单机版(AI伴侣2.47版) 2020-02-05更新
  • AI2(App Inventor 2)离线版服务器网络版(AI伴侣2.47版)
  • 一、初学者入门
  • 二、离线服务器下载
  • 三、离线服务器增强
    • App Inventor 2批量添加用户(注意:版本不同,修改位置会有所不同)
    • war\WEB-INF\appengine-web.xml相关设置
    • win 64下使用nginx为App Inventor 2 离线服务器做反向代理服务。
    • 修改App Inventor 2源码,5M<上传,5M<编译<10M
    • 修改web.xml 禁止访问/_ah/admin
    • 搭建一个PHP版本passmail服务器给AI 2服务器发送改密码链接邮件
    • 本地命令行编译AIA到APK文件
    • 离线服务器设置 浏览器打开页面语言自动为中文
    • 类似MIT的“帮助”--“AI同伴信息”
  • 四、虚拟机与AI伴侣汇总
  • 五、搭建本地AI2 (App Inventor 2) 服务器
  • 其他资料
RSS feed
Powered by Drupal