Apache?
...is not needed: Snakelets contains its own multithreaded web server. But if you still want to use Apache, you can use mod_proxy or mod_rewrite to let Apache forward certain requests to a running snakelets server behind it. Plans exist to develop a snakelets module for tighter integration in Apache, and for more performance. But for now, you'll have to use mod_proxy (or mod_rewrite).
Apache?
…没有必要使用:snakelets 包括自己特有的 multithreaded(不知道是虾米意思) web server。不过如果你坚持要用Apache的话,你可以使用mod_proxy 或mod_rewrite 来让apache指向某些来自snakelets的请求。正在计划开发一个snakelets的模块来让apache和snakelets紧密结合起来,并使其功能更加完善。但是目前您还只能够使用mod_proxy 或者 mod_rewrite。
Configuring Apache; bottom line: Set up apache to reverse-proxy everything after snake/ to Snakelets.
配置Apache;概要:安装 apache 来 reverse-proxy(??什么意思??)snake/下的所有东西到Snakelets。(这段好像是说翻转代理所有snake/目录下的东西到 Snakelets,使得Snakelets可以解析此目录下的所有页面)
Warning: as the Apache manual also states, regarding the use of proxies: please secure your Apache configuration: do not let it become an open proxy server!
警告:在Apache参考中关于proxies的描述:
请注意Apache的配置安全问题:不要让你的apache成为一个开放的proxy server
Edit your Apache config file. Make sure that mod_proxy is loaded in the LoadModule section.
编辑你的Apache 配置文件。确认mod_proxy在LoadModule段落中被载入。
Configure the forwarding to the Snakelets server:
配置 forwarding 到 Snakelets server:- ProxyRequests Off
- ProxyPass /snake/ http://localhost:9080/snake/
- ProxyPassReverse /snake/ http://localhost:9080/snake/
复制代码 This example forwards all requests starting with '/snake/' to Snakelets. You can also configure a dedicated virtual host, for example:
例子是指向 /snake/ 目录的,你也可以设置专门的虚拟主机:- <VirtualHost snakelets.host.domain>;
- ServerName snakelets.host.domain
- ProxyRequests Off
- ProxyPass / http://localhost:9080/
- ProxyPassReverse / http://localhost:9080/
- </VirtualHost>;
复制代码 Now all requests to this hostname will be passed to Snakelets.
现在所有的请求会被发送到snakelets。
Then run Snakelets where you set (in serv.py) bindname='localhost', serverURLprefix='/snake/' and externalPort=80. If you use the virtualhost mapping, the serverURLprefix is empty.
在serv.py中设置bindname='localhost', serverURLprefix='/snake/' , externalPort=80 。如果您使用virtualhost mapping , 那么servURLprefix 为空。
Note: if you are using mod_cache, you must tell it to not cache the Snakelets urls! This can be done like this:
注意:如果您使用 mod_cache,那么必须说明不缓存 Snakelets urls !设置如下:- <IfModule mod_cache.c>;
- CacheDisable /your-snakelet-url-base
- </IfModule>;
复制代码 If you find that your URLs are not correct in Snakelets, you also have to enable virtual hosting in Snakelets (see below) and create a virtual host entry for the 'correct' hostname (i.e. the hostname that is used in your URLs). (You can still use a different bindname such as "localhost".
如果您的URLs在snakelets中不正确,你也必须在snakelets中开启虚拟主机(见下文)并且为正确的主机名开放入口(也就是在您的URLs中所使用的主机名)。(您仍然可以使用不同的bindname,比如”localhost”)。 |