Windows下配置mongoose

本文详细介绍了如何在Windows系统中安装并配置Mongoose,包括快捷方式编辑、安装程序创建的快捷菜单操作、配置文件编辑、解决防火墙问题、共享文件、运行CGI脚本、限制特定客户端访问、密码保护文件夹等功能,以及在Windows下设置PHP的相关步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Windows上安装与配置Mongoose的一般事宜

Mongoose能够作为Windows控制台应用程序启动。


在快捷方式中有一个“Edit config”,可以用它来进行默认配置的修改。

An installer creates shortcuts in the Start menu, most important ones are "Edit config", "Start service" and "Stop service". These are needed when you want to change the default configuration. "Edit config" starts up an editor, where you can tweak any option. Most importantoptions are:

root - where your HTML files live. By default, it is set to "C:\", change it to the directory you want.

cgi_interp - this must be a full path to the CGI interpreter program. If you use Perl for your CGI files, or PHP, or anything else - please 

put the full path to perl.exe, or php-cgi.exe, or whatever you are using as CGI interpreter. PHP NOTE! For PHP 5.x and older, the correct 

CGI interpreter is php-cgi.exe, not php.exe.


在配置文件中,空行或者以“#”开头的行都将被忽略。其他的行必须以合法的option名开始,后面接上空格(数量无所谓),再接上option需要的值。如果需要配置的option没有写上,那么将使用默认值。配置生效需要关闭配置文件,并且重启Mongoose

This can be done by stopping the service, and starting it again.


关于windows防火墙应注意的问题。

If you have Windows firewall running, it may block web connections to your machine. This means that while you can access your web 

pages from the machine that runs Mongoose, you may not access them from other computers. To allow web connections to the machine, go to the control panel, windows firewall, add exception, add port, TCP port 80 and TCP port 443.


Advanced uasge

 Mongoose.exe本身就是个可执行的文件,安装步骤只是把文件压缩包给解压到指定文件夹,然后注册Windows服务。对于官网的3.0,就是一个简单的exe文件。


共享文件:

If you wish to share some files really quickly, just copy mongoose.exe into the directory you wish to share, and double-click it. This will runMongoose in console mode, on port 8080. Point your browser to http://your_machine:8080 to see shared files. 


运行CGI脚本:

Setting cgi_interp option is not the only way of running CGI scripts. You can leave this option unset. In this case, the first line of your CGI script must be #!c:\full\path\to\cgi_interpreter. This allows to run CGI scripts with different CGI interpreters, for example, Perl, PHP, at the same time.

指定访问服务器的特定客户机:

 It is possible to restrict access to the web server to certain machines only. To do that, set acl option this way: acl -0.0.0.0/0,+machine1,

+machine2, where machine1, machine2 are IP addresses of the machines allowed to connect.


指定访问某些文件夹需要密码:

 It is possible to protect certain folders with password. To do that, you have to create passwords file in that folder. Start command prompt, run following commands:

c:\mongoose-2.1\mongoose.exe-A c:\folder\to\protect\.htpasswd mydomain.com user1 password1
c:\mongoose-2.1\mongoose.exe-A c:\folder\to\protect\.htpasswd mydomain.com user2 password2


给所有需要加密文件夹指定加密文件:

It is possible to protect certain folders with password. To do that, you have to create passwords file in that folder. Start command prompt, run following commands:

c:\mongoose-2.1\mongoose.exe-A c:\folder\to\protect\.htpasswd mydomain.com user1 password1
c:\mongoose-2.1\mongoose.exe-A c:\folder\to\protect\.htpasswd mydomain.com user2 password2


在windows下设置PHP

Here are some basic instructions on how to set up PHP under Mongoose on current versions of Windows (some modifications would be needed for Linux):

  • Choose a folder to be your server root and home to Mongoose and PHP.
  • Either install Mongoose as a Service (recommended) or run mongoose.exe.
  • Download any recent version of the PHP binaries for Windows from http://PHP.net. You need the basic PHP executable files php5.dll and php-cgi.exe; copy them to your root folder. If you want to use a database, copy its PHP extension file, such as php_sqlite3.dll (which I recommend for its small size and high speed), to your root folder as well.
  • Create the text file php.ini from the default php.ini distributed with the PHP Windows binaries. Consider making the following changes:
short_open_tag = On (to use "<? ?>" instead of "<?php ?>")
max_execution_time = 15
max_input_time = 10
memory_limit = 16M
display_errors = On (turn Off after debugging)
display_startup_errors = On (turn Off after debugging)
log_errors = Off
html_errors = Off
magic_quotes_gpc = Off
extension_dir = "C:\root" (change to your root path)
;extension=php_sqlite3.dll (put extension DLLs in your root)
;extension=php_mysql.dll
date.timezone=US/Eastern (Change to your time zone)
   (You can find a list of time zone names in the following PHP program:
  http://bluequartz.org/svn/5100R/tags/raq550_OSS_1_0/ui/palette/libPhp/uifc/TimeZone.php)
  • Create the text file mongoose.conf containing your desired server settings. For PHP, be sure to include:
(Warning--2.8 syntax)
cgi_interp      php-cgi.exe
cgi_ext         php
  • For testing and debugging, create the text file info.php containing:
<?php
phpinfo();
?>

(Note that the function call "phpinfo()" generates all the needed
HTML for the information page it generates, so nothing else should
go in "info.php".)
  • Don't forget to create a default file such as index.html or index.php, an error handling file such as error.php, and a home icon filefavicon.ico for your server.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值