Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7775817
  • 博文数量: 701
  • 博客积分: 2150
  • 博客等级: 上尉
  • 技术积分: 13233
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-29 16:28
个人简介

天行健,君子以自强不息!

文章分类

全部博文(701)

文章存档

2019年(2)

2018年(12)

2017年(76)

2016年(120)

2015年(178)

2014年(129)

2013年(123)

2012年(61)

分类: 服务器与存储

2013-07-21 10:09:27

1. 闲言少述,先上代码,搭建Http server

#!/usr/bin perl
#############################################################################
# \File
#    HTTPServer.pl
# \Brief
#    Setting the http server
# \Author
#    Hank
#############################################################################


use HTTP::Server::Encrypt qw(http_server_start);

my %http_conf;
$http_conf{'port'} = 80;
#$http_conf{'username'} = 'username';
#$http_conf{'passwd'} = 'passwd';
$http_conf{'min_spare'} = 2;
$http_conf{'max_spare'} = 6;
$http_conf{'static_expires_secs'} = 0;
$http_conf{'docroot'}   = 'plugins/';
$http_conf{'log_dir'}   = '/opt/httpserverlog';

http_server_start(\%http_conf);


2. 具体的参数详解可见CPAN上的解释



3. 后台方式启动和停止
代码如下:
File: start_httpserver.sh
perl HTTPServerDaemon.pl

File: stop_httserver.sh
cat HTTPServerDaemon.pl.pid | xargs kill


启动与停止:
$ ./ start_httpserver.sh
$ ./ stop_httpserver.sh

阅读(2805) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~