本文主要基于支持perl的web服务器的选择。

  一直基于web开发,服务器都是linux下使用webmin搭建的,惭愧的说一句,这么多年,也好好研究过WEB服务器,单从这个角度,是不是可以反应出webmin架构和俺们产品的build做得还算OK呢,才可以让大家伙将更多的精力集中,自身产品的业务上,而不用每个人都更多花大量时间在一些早已成熟的技术上,如果每个产品都以这个思想来做,那么这个社会将有更少的重复劳动,和更高效的产出,扯远了,回来继续关于Windows下搭建web服务器。

  A long time ago, Windows included a simple program called Personal Web Server (PWS) which provided an easy little webserver to use with Perl. With the release of Windows ME and XP, PWS was discontinued and replaced with Internet Information Server, known as IIS. Last time I tried, which I freely admit was quite a while ago now, configuring IIS for use with Perl was not that easy. There are simpler ways of doing it.

  If you just want a simple webserver to test with, I recommend a different webserver than IIS. This webserver is free, and is well documented. You can find it at Aprelium. Look for the Abyss Web Server X1. It works very well and is much easier to set up than IIS. The exact configuration details are spelled out in the documentation for the X1 server so I won't repeat them here. But I think you'll find it is pretty easy to install and set up.

  If you want something more configurable and powerful, you can't go wrong with the Apache webserver, which is available for Windows just as readily as for Linux. Again, the exact configuration details are not provided here, since there is Apache documentation for this. However, if enough users ask for explicit instructions to be included here, start asking by email, and I'll add them in.

1       PWS(perlwerbserver)

2000后不再维护和使用,使用方法参考文档较少,初测发现windows下使用,服务经常会停止。不推荐使用。

install web server:https://www.gossland.com/perlcourse/default/install_pws.html

perlwebserver by 2000 year:http://perlwebserver.sourceforge.net/

2       Aprelium

下载Abyss Web Server X1免费版本后,尝试安装,报错,无法安装成功,看来免费版本错误处理及冗错做得不是太好,未做更多尝试。

aprelium:http://www.aprelium.com/

3       基于apache的WEB服务器

如今主流的Web服务器软件主要由IIS或Apache组成。IIS支持ASP且只能运行在Windows平台下,Apache支持PHP,CGI,JSP且可运行于多种平台,虽然Apache是世界使用排名第一的Web服务器平台,但是众所周知,Windows以易用而出名,也因此占据不少的服务器市场。本专题我们把Web服务器划分为Windows平台和Linux平台(包括各种Unix)。

简易过程

  1、安装apache WEB服务器

  2、运行第一个apache WEB页面

     开启服务,管理->服务,运行apache。

    服务开启后,通过浏览器访问127.0.0.1,apache服务器会默认去安装目录的htdocs目录下打开默认已存在的index.html。

  3、安装perl解释器

  4、配置apache允许打开CGI页面

    配置文件目录,安装目录下的conf目录,修改httpd.conf文件,DirectoryIndex index.html index.cgi(加入index.cgi)

  5、运行第一个cgi页面

    将程序放到apache安装目录的cgi-bin目录下,通过web访问http://127.0.0.1/cgi-bin/index.cgi即可。

index.cgi:

#!c:/perl/bin/perl(perl的安装目录)

use CGI qw(:standard);

use strict;

print header;

print "<B>it works ! hello world</B>";

  6、使用模版方式,将html从CGI中分离

index.cgi:

#!c:/perl/bin/perl

use strict;

print "Content-type: text/html\n\n";

print &Template("../htdocs/index.html");

sub Template

{

  my $file;

  my $HTML;

  $file = $_[] || die "Template: No template file specified.\n";

  open (FILE,"<$file") || die "Template: Couldn't open $file:$!\n";

  while (<FILE>) { $HTML .= $_; }

  close(FILE);

  #下面两个语句实现的功能相同

  $HTML =~ s/(\$\w+)/eval "$1"/ge;

  #$HTML =~ s/\$(\w+)/${$1}/g;

  return $HTML;

}

参考文献

WEB服务器搭建:

http://school.cfan.com.cn/zhuanti/webserver/

apache WEB服务器搭建:

http://carywu.blog.51cto.com/13185/9551

基于apache的perl实现动态页面:

http://www.oschina.net/question/17_71

CGI配合HTML模板使用:

http://www.linuxfly.org/post/335/

Windows下WEB服务器的选择与搭建的更多相关文章

  1. Windows下Git服务器搭建[转]

    Windows下Git服务器搭建   作为对前两天Git服务器搭建的一个整理,我想分别从服务端和客户端两个角度来记录下整个搭建过程,为了达到目标,我们需要哪些操作. (一)服务端软件和账号的安装配置 ...

  2. Windows下SVN服务器搭建方法整理(apache)

    http://skydream.iteye.com/blog/437959 http://www.cnblogs.com/liuke209/archive/2009/09/23/1572858.htm ...

  3. CentOS下Web服务器环境搭建LNMP一键安装包

    CentOS下Web服务器环境搭建LNMP一键安装包 时间:2014-09-04 00:50来源:osyunwei.com 作者:osyunwei.com 举报 点击:3797次 最新版本:lnmp- ...

  4. Qt4.8在Windows下的三种编程环境搭建

    Qt4.8在Windows下的三种编程环境搭建 Qt的版本是按照不同的图形系统来划分的,目前分为四个版本:Win32版,适用于Windows平台:X11版,适合于使用了X系统的各种Linux和Unix ...

  5. windows下用eclipse+goclipse插件+gdb搭建go语言开发调试环境

    windows下用eclipse+goclipse插件+gdb搭建go语言开发调试环境   http://rongmayisheng.com/post/windows%E4%B8%8B%E7%94%A ...

  6. Windows下Wireshark安装版本选择方式

    Windows下Wireshark安装版本选择方式   Wireshark版本分为1.X系列和2.X系列.1.X系列是早期版本,不提供中文版本.2.X系列是新版本,安装后,同时提供中文版和英文版.根据 ...

  7. Windows下HG服务器的搭建

    1.环境和所需工具安装 1. 安装python-2.7.9.exe 2. 安装mercurial-3.2.3.win32-py2.7.exe 3. 安装mercurial-3.2.3-x86.msi ...

  8. Windows下Apache服务器搭建

    Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,是世界使用排名第一的Web服务器软件,可以在大多数计算机操作系统中运行,由于其多平台和安全性 ...

  9. Windows下SVN服务器的搭建步骤

    1.下载svn服务端和客户端 服务端VISUALSVN SERVER:https://www.visualsvn.com/ 客户端TortoiseSVN:https://tortoisesvn.net ...

随机推荐

  1. mac打开.caj格式文件

    以为用mac后使用会变得更方便些,写毕设时终于派上用场,可惜啊,mac竟然打不开.caj文件,这意味着什么?相信所有在做毕设的小伙伴们都能懂其中的凄凉.特别是硕士或博士的论文,你得从知网上下上百篇的文 ...

  2. Objective-C: 字符串NSString与NSMutableString

    字符串算是OC中非常重要和常用的一部分内容,OC中的字符串与我之前在学习C,C++,Java中的字符串有一定的不同,它非常类似于C++中容器的概念,但用法却与之还是有很大的不同,也许是因为OC的语法就 ...

  3. JS工作积累

    /* * YYYY-MM-DD类型的字符串日期比较 * */ String.prototype.compareAsDate=function(dateStr){//prototype原型方法 var ...

  4. SQL Server2008 TIME类型

    SQL Server2008现在有了一个TIME数据类型,它允许你只存储一个时间值而没有时间.如果想要存储一个特定的时间信息而不涉及具体的日期时,这将非常的有用.TIME数据类型存储使用24小时制,它 ...

  5. List<Object>和List<String>

    下面的代码在JAVA中是不可以的: import java.util.*; public class Test { public static void main(String[] args) { L ...

  6. SVN提交数据失败问题(提示 svn:MKACTIVITY ... 403 Forbidden )

    注册了淘宝svn,结果在代码提交是老是出问题,如下截图所示: 网上有常用的一种方法是: http://jingyan.baidu.com/article/67508eb4d3f2e29ccb1ce47 ...

  7. POJ 2157 Evacuation Plan [最小费用最大流][消圈算法]

    ---恢复内容开始--- 题意略. 这题在poj直接求最小费用会超时,但是题意也没说要求最优解. 根据线圈定理,如果一个跑完最费用流的残余网络中存在负权环,那么顺着这个负权环跑流量为1那么会得到更小的 ...

  8. nyoj 85 有趣的数

    点击打开链接 有趣的数 时间限制:3000 ms  |  内存限制:65535 KB 难度: 描述 把分数按下面的办法排成一个数表. 1/1 1/2 1/3 1/4..... 2/1 2/2 2/3. ...

  9. 网站注册(css)

    <! DOCTYPE HTML><html><head><meta charset="utf-8"><title>作业2 ...

  10. jmeter随笔(29)-关于自己的jar包和beanshell的使用

    点击标题下「蓝色微信名」可快速关注 坚持的是分享,搬运的是知识,图的是大家的进步,没有收费的培训,没有虚度的吹水,喜欢就关注.转发(免费帮助更多伙伴)等来交流,想了解的知识请留言,给你带来更多价值,是 ...