dongsimu4422 2015-06-15 16:09
浏览 41

g-wan中的配置文件在哪里?

Where is the configuration file (init.d) in g-wan. Also how do I get rid of the '?' In the url to run php or c script ( I think you need to change this in the configure)?

  • 写回答

2条回答 默认 最新

  • douxing9228 2015-06-15 16:54
    关注

    There is no configuration "file" per se. For example, port and IP address are configured as folder names (e.g., 172.16.42.2:8080/...) under the root gwan folder.

    Servlets, whether written in php or C or whatever you choose, are in the .../csp folder under the IP:port path under the gwan folder. With G-WAN, by default, the path to a servlet begins with '?' followed by the servlet name AND extension (e.g., '.php'), and the first parameter is preceded by '&' like the 2nd - nth parameter is with most web servers.

    You can change virtually ANYTHING you want about the URL, path, special characters, etc. in a handler, which you can also write in C/C++, etc. Handlers are in the .../handler folder under the IP:port path under the gwan folder. What you are asking about specifically is a form of URL-rewriting, and can be done in a handler via a simple string-replacement function (see the examples that come with G-WAN).

    There are MANY examples of servlets in the .../csp folder, and several examples of handlers in the .../handler folder. Most likely you can choose among those and modify them to meet your needs.

    FYI, typical naming convention used with G-WAN to disable something at a folder level is to precede it with '_' (e.g., _0.0.0.0:8080/...), and for an individual file to be disabled it is postfixed with '_' (e.g., hello.c_).

    The G-WAN developers page has a Connection Handler URL-rewrite example that (I think) does what you want. The specific code to rewrite an incoming request URL (containing no "?") with a URL that references a specific G-WAN servlet (and contains the "?") looks like this:

    // rewrite /blog requests into /?blog requests
    xbuf_replfrto(read_xbuf, read_xbuf->ptr, read_xbuf->ptr + 16, "/blog", "/?blog");
    

    See http://gwan.com/developers#tab2 for the complete example. You will need to create a similar Connection Handler (or just copy the example code and change to meet you needs), and then place that Handler code in the .../handlers path under the IP:port path under the gwan root folder.

    Sorry I can't be more specific with a PHP example; I've done all my G-WAN work in C/C++ so far.

    评论

报告相同问题?

悬赏问题

  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示