欢迎来到福编程网,本站提供各种互联网专业知识!

在CentOS系统中编译安装Hiawatha服务器的教程

发布时间:1970-01-01 作者:佚名 来源:互联网
这篇文章主要介绍了在CentOS系统中编译安装Hiawatha服务器的教程,包括相关的PHP连接设置,需要的朋友可以参考下

Hiawatha 是一个Linux/UNIX下安全的Web服务器,其设计的最主要的目的就是安全,当然它也是快速的而且易于配置。在安装之后,确实发现他真的是轻量级的,安装部署相当的快。以下是安装的过程:

第一步:下载编译安装cmake因为Hiawatha要求是cmake才能编译,我的系统里没有安装,但是注意,这里的cmake是有版本要求的,至少是2.8.4以上的版本,索性我就安装了最新的版本cmake 2.8.10.

复制代码代码如下:#wgethttp://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz

#tar xvf cmake-2.8.10.2.tar.gz

#cd cmake-2.8.10.2

本机上不存在cmake。则

复制代码代码如下: #./bootstrap

#make

#make install

如果系统中已经装了低版本的cmake,输入如下命令:

复制代码代码如下:#cmake

#make

#make install

第二步:下载Hiawatha(libxml2 and libxslt是hiavatha必须要求的,没有的自行安装,我已经有了)

复制代码代码如下:#wget --no-check-certificate https://www.hiawatha-webserver.org/files/hiawatha-9.0.tar.gz //wget

可以下载http,https,ftp的链接,这里是https,所以我们设置为不检查证书,直接下载,参考wget下载https链接(转)

复制代码代码如下:#tar -xzf hiawatha-9.0.tar.gz

#cd hiawatha-9.0

#mkdir build

#cd build

#cmake .. -DENABLE_CACHE=ON -DENABLE_DEBUG=off -DENABLE_IPV6=off -DENABLE_MONITOR=off -DENABLE_RPROXY=ON -DENABLE_SSL=ON -DENABLE_TOMAHAWK=off -DENABLE_TOOLKIT=ON -DENABLE_XSLT=off

#make

#make install

#hiawatha -k //检测安装是否成功,如果输出以下提示,则表示安装成功

Using

Reading hiawatha.conf

Configuration OK

注意:运行cmake时候如果出现

复制代码代码如下:CMake Error: Could not find CMAKE_ROOT !!!

CMake has most likely not been installed correctly.

Modules directory not found in

/usr/bin

CMake Error: Error executing cmake::LoadCache(). Aborting.

的错误提示,很大的可能不是你的cmake的设置有问题,输入“echo $CMAKE_ROOT”,看返回时什么,如果没有返回,或返回的不是你的cmake安装的目录,那么就肯定会出现这个错误,因为找不到 CMAKE_ROOT 这个变量值, 那我们就可以输入以下命令,告诉系统,cmake的安装目录是哪里,

复制代码代码如下:#export CMAKE_ROOT=/usr/local/bin/cmake

这个根据自身的安装路径设定,就可以解决这个错误了

有的可能在编译的时候还出现下面的错误:

复制代码代码如下:bash: /usr/bin/cmake: No such file or directory

方法:这也是系统找不到cmake在哪,所以我们一样要告诉系统

复制代码代码如下:#ln -s /usr/local/bin/cmake /usr/bin //做一个软连接

如果上面都没生效,你又记者用cmake编译,最快的方法是用find命令,查看cmake的可执行文件在哪里,然后直接用cmake可执行文件的绝对路径来编译

如:

复制代码代码如下:find / -name "cmake"

显示结果:

复制代码代码如下:/usr/local/bin/cmake

那么,你可以这样编译:

复制代码代码如下:/usr/local/bin/cmake 后面加上你要编译和源代码路径和编译的参数

第三步:修改配置文件hiawatha.conf

复制代码代码如下:#vi /usr/local/etc/hiawatha/hiawatha.conf

我没多大修改配置:

复制代码代码如下:# Hiawatha main configuration file

#

# GENERAL SETTINGS

#

ServerId = www:www

ConnectionsTotal = 250

ConnectionsPerIP = 25

SystemLogfile = /usr/local/var/log/hiawatha/system.log

GarbageLogfile = /usr/local/var/log/hiawatha/garbage.log

# BINDING SETTINGS

# A binding is where a client can connect to.

#

Binding {

Port = 80

# Interface = 127.0.0.1

# MaxKeepAlive = 30

# TimeForRequest = 3,20

}

#

#Binding {

# Port = 443

# Interface = ::1

# MaxKeepAlive = 30

# TimeForRequest = 3,20

# SSLcertFile = hiawatha.pem

#}

# BANNING SETTINGS

# Deny service to clients who misbehave.

#

BanOnGarbage = 300

BanOnMaxPerIP = 60

BanOnMaxReqSize = 300

KickOnBan = yes

RebanDuringBan = yes

# COMMON GATEWAY INTERFACE (CGI) SETTINGS

# These settings can be used to run CGI applications.

#

#CGIhandler = /usr/bin/perl:pl

#CGIhandler = /usr/local/php/bin/php-cgi:php

#CGIhandler = /usr/bin/python:py

#CGIhandler = /usr/bin/ruby:rb

#CGIhandler = /usr/bin/ssi-cgi:shtml

#CGIextension = cgi

FastCGIserver {

FastCGIid = PHP5

ConnectTo = /var/lib/hiawatha/php-fcgi.sock //根据自己所在的位置填写

Extension = php

}

# URL TOOLKIT

# This URL toolkit rule was made for the Banshee PHP framework, which

# can be downloaded from http://www.hiawatha-webserver.org/banshee

#

#UrlToolkit {

# ToolkitID = banshee

# RequestURI isfile Return

# Match ^/(css|files|images|js|slimstat)($|/) Return

# Match ^/(favicon.ico|robots.txt|sitemap.xml)$ Return

# Match .*?(.*) Rewrite /index.php?$1

# Match .* Rewrite /index.php

#}

# DEFAULT WEBSITE

# It is wise to use your IP address as the hostname of the default website

# and give it a blank webpage. By doing so, automated webscanners won't find

# your possible vulnerable website.

#

Hostname = 127.0.0.1

WebsiteRoot = /home/wwwroot

StartFile = index.html

AccessLogfile = /usr/local/var/log/hiawatha/access.log

ErrorLogfile = /usr/local/var/log/hiawatha/error.log

ErrorHandler = 404:/error.cgi

# VIRTUAL HOSTS

# Use a VirtualHost section to declare the websites you want to host.

#

#VirtualHost {

# Hostname = 127.0.0.1

# WebsiteRoot = /home/wwwroot

# StartFile = index.php

# AccessLogfile = /var/www/my-domain/log/access.log

# ErrorLogfile = /var/www/my-domain/log/error.log

# TimeForCGI = 5

# UseFastCGI = PHP5

# UseToolkit = banshee

#}

# DIRECTORY SETTINGS

# You can specify some settings per directory.

#

#Directory {

# Path = /home/baduser

# ExecuteCGI = no

# UploadSpeed = 10,2

#}

启动命令:

复制代码代码如下:#/usr/local/sbin/hiawatha //根据自己的安装目录决定

关闭停止命令:

复制代码代码如下:#pgrep hiawatha //查看hiawatha的pid

#kill -15 pidnumber //pidnumber就是hiawatha的pid

以下是php-fpm.confg

复制代码代码如下: [www]

user = www

group = www

listen = /var/lib/hiawatha/php-fcgi.sock

pm = static

pm.max_children = 3

chdir = /

相关推荐