⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 devel.pi3

📁 mini http server,可以集成嵌入到程序中,实现简单的web功能
💻 PI3
📖 第 1 页 / 共 3 页
字号:
#!Pi3

# ===
#
# Top level configuration file
#
#	** IMPORTANT **
#	If you do nothing else then do this:
#

#... ##### Customize server settings

# Skip below to the definition of 'MainVirtualHostInformation', change
# the settings for Hostname (*Mandatory* redirects will not work without
# this!) and Administrator (optional).
#
# ===

# Include  standard IO and server stuff
include ../Conf/IO.cnf
include ../Conf/Server.cnf
include ../Conf/Pi3API.cnf
include ../Conf/SSL.cnf

# ---
#
# IO Object for main listening socket.
#
# ---
<Object>
    Name ServerIOObject
    Class TCPIPIOClass
    Type Passive

# A hostname must be specified for the Pi3Web HTTP server. The hostname
# will be used by the server lookup the IP address that this server will
# listen on. A value of INADDR_ANY let the server listen on any IP address.
	BindHost localhost

# A TCP port must be specified for this HTTP server. The TCP port
# is the port that the HTTP will listen for requests on. This is
# typically 80 for HTTP servers. 
#
# Note that UNIX operating systems normally require that the server
# initially run as user 'root' to bind on ports between 0 and 1024
	BindPort 80
#	BindPort 443

# Timeout accepting connections. -1 specifies no timeout.
	AcceptTimeout -1

# Specify timeout for sending data. -1 specifies no timeout. 

	RecvTimeout 60

# Specify timeout for receiving data. -1 specifies no timeout. 
	SendTimeout 45
	PeerIPVariable STRING:RemoteAddr
	PeerHostNameVariable STRING:RemoteHost
	LocalAddressVariable STRING:LocalAddr
	ServerPortVariable RFC822:ServerPort
	
# Flags
#
#   OwnDB - Object adds its own DB, rather than use the parents
#               this is necessary to avoid collision of values placed in
#               the DB between different connection. 
#
#   SetPeerAddress - IP address of remote peer with be put
#               into the specified variable.
#
#   DNSReverseLookup - Use reverse DNS to get the hostname of the 
#               peer and place it in the specified variable.
#
#   SetLocalAddress - Put local address in the specified variable.
	Flags OwnDB|SetPeerAddress|DNSReverseLookup|SetLocalAddress

# Pointer to file with lockfile name, to avoid collisions on accept
# with multiple processes
	AcceptLockFile  "../Logs/lockfile.txt"
</Object>

# ---
#
# SSL IO filter object
#
# ---
<Object>
    Name SSLIOObject
    Class SSLClass

# Type, passive (server) or active (client)
	Type "Passive"

# SSL version, "2"=SSLv2 only, "3"=SSLv3 only and "23"=SSLv2 or SSLv3
	Version 23

# Verify depth to verify client certificates before giving up.
	VerifyDepth 1

# Client certificate verification,
#	0=No verification performed
#	1=Certificate is verified, but not mandatory
#	2=Certificate must be present
	Verify 0

# lower level IO object that SSL layer uses for transport
#	IOObject SnoopIO IOObject="ServerIOObject" OutFile="./encrypt.dbg" Flag="Verbose"
	IOObject ServerIOObject

	CACertificatePath "./"
	CACertificateFile "cacert.pem"

# insert the name of your key file here
	PrivateKeyFile "./key.pem"

# insert the name of your certificate file here
	CertificateFile "./cert.pem"

# DebugFile output, filename or 'STDERR' or 'STDOUT'
#	DebugFile "STDERR"
#	DebugFile "../Logs/SSL.txt"

# Flag, miscellanious options, "Bugs", "Hack", etc.
	Flag "Bugs"
	Flag "Hack"

# List of acceptable ciphers, disable to allow all valid cipher suites.
#	CipherList "DEFAULT"
#	CipherList "NULL-MD5"
	CipherList "!ADH:RC4+RSA:HIGH:MEDIUM:LOW:EXP:+SSLv2:+EXP"
</Object>

# ---
#
# Main virtual host object.
#
# ---
<Object>
	Name MainVirtualHostInformation
	Class VirtualHostClass

# Administrator for the primary virtual host
	Administrator webmaster@localhost

# Hostname that this server uses in redirects.
	HostName localhost

# Port that the server uses in redirects.
# Specify it only if it is not the standard port for the protocol in
# use, i.e. 80 for HTTP and 443 for HTTPS
#	ServerPort 80

</Object>

# ---
#
#    Thread dispatch object
#
#   This is an instance of MultiThreadedIOServerClass with appropriate
#   parameters
#
# ---
<Object>
	Name ThreadPoolDispatcher
	Class MultiThreadedIOServerClass

# The IOObject is the object that will be used for the listening socket
# it can be a real IOObject (such as TCP/IP), as test IO object which 
# feeds stub data into the server or a filter IO object which encrpts
# or logs data passed through it.
#
#    Example test IO object:
# 	IOObject TestIOObject
#
#    Log IO to file:
#	IOObject SnoopIO IOObject="ServerIOObject" OutFile="./snoop.dbg"
#
	IOObject ServerIOObject
#	IOObject SSLIOObject

# Dispatch accepted IO connection to the HTTPLogicObject
	LogicObject HTTPLogicObject

# Number of threads to use 
	MaxThreads 10

# Number of requests to exit after
	ExitAfter 1000

</Object>


# ---
#
# Main Pi3 object. 
#
# This is an instance of the UNIXDaemonClass to fork the server into
# one monitor process and 'NumberOfProcesses' child processes. 
#
# The monitor process automatically starts a new child processes whenever
# a child process exits.
#
# ---
<Object>
	Name Main
	Class UNIXDaemonClass

# Actual class to accept new IO requests and dispatch them
	ServerObject ThreadPoolDispatcher
	PIDFile "../Logs/pid.log"
	RLimitCpu Maximum

# User that child processes will run as. Server must run as root to 
# be able to change to the specified user. A user id number can be
# specified with #number. Server which start with root privileges should
# change to a user id with lesser privileges for security reasons.
#   User nobody

# Group that child processes will run as. Server must run as root to
# be able to change to a different group. A group id number can be
# specified with #number.
#   Group #-1

# generate a server unique lockfile name and write it into
# Logs/lockfile.txt
	LockFileName "../Logs/lockfile.txt"

# Message to write just before the server is ready to start accepting
# connections.
# default
	Message "Pi3Web HTTP Server Started"

# Specify the number of processes. 

	NumberOfProcesses 8

</Object>


# ===
#
# Devel.pi3
#
#	Features of Pi3Web useful for web application development.
#
# ===

#
# Load library definitions for classes used here.
#
include ../Conf/HTTP.cnf
include ../Conf/Fcgi.cnf
include ../Conf/Plugins.cnf
include ../Conf/ISAPI.cnf
include ../Conf/PHP4.cnf

# ---
#
# TestIOObject
#
# Substitute in place of ServerIOObject 
# This stub IO object then feeds canned input into the server as if
# it came from the network.
#
# Leave it a day or two to run 10,000,000 and then examine the state
# of the system and logfiles for errors.
#
# When a new server feature is added make a new .dat file and add
# it here for the server to cycle through it.
#
# ---
<Object>
	Name TestIOObject
	Class StubIOClass
	HTTPEquiv "RemoteAddr: 172.23.23.1"
	HTTPEquiv "RemoteHost: me.you.dom"
	HTTPEquiv "LocalAddr: 127.0.0.1"
	HTTPEquiv "SendTimeout: 45"
	HTTPEquiv "RecvTimeout: 60"
	ErrorAfter 100000

	# Simple tests
	DataFile "../Tests/t1.dat"
	DataFile "../Tests/t2.dat"
	DataFile "../Tests/t3.dat"
	DataFile "../Tests/t4.dat"
	DataFile "../Tests/t5.dat"
	DataFile "../Tests/t6.dat"
	DataFile "../Tests/t7.dat"
	DataFile "../Tests/t8.dat"
	DataFile "../Tests/t9.dat"

	# Largely CGI
	DataFile "../Tests/t10.dat"
	DataFile "../Tests/t11.dat"
	DataFile "../Tests/t12.dat"
	DataFile "../Tests/t13.dat"
	DataFile "../Tests/t14.dat"
	DataFile "../Tests/t15.dat"
	DataFile "../Tests/t16.dat"
	DataFile "../Tests/t17.dat"
	DataFile "../Tests/t18.dat"
	DataFile "../Tests/t19.dat"

	# FastCGI
	DataFile "../Tests/t31.dat"
	
	# Image maps
	DataFile "../Tests/t41.dat"
	DataFile "../Tests/t42.dat"
	DataFile "../Tests/t43.dat"
	DataFile "../Tests/t44.dat"
	DataFile "../Tests/t45.dat"

	# SSI
	DataFile "../Tests/t61.dat"

	# Pi3Expressions
	DataFile "../Tests/t71.dat"

	# ISAPI
	DataFile "../Tests/t81.dat"

	# Bad things
	DataFile "../Tests/t100.dat"
</Object>

# ---
#
# Documentation is handled as HTML regardless of file extension. Also,
# files have headers and footers attached to make them pretty.
#
# ---
<Object>
	Name DocumentMapper
	Class PathMapperClass
	#
	# leave calling card
	#
	Action "&dbreplace(response,string,ObjectMap,Pi3Docs)"
</Object>

# ---
#
# CGIMapper
#
#	Instance of PathMapperClass to Map CGI URLs
#
#	CGI Scripts set PATH_INFO. 
#
# ---
<Object>
	Name CGIMapper
	Class PathMapperClass
	CaseSensitive "No"
	#
	# Subdirectories below the mapping directory should be put in path info
	#
	PathInfo "Yes"
	#
	# Set the 'ObjectMap' variable in the response DB if this map is
	# successful
	#
	Action "&dbreplace(response,string,ObjectMap,Scripts)"
</Object>

# ---
#
# WinCGIMapper and FCGIMapper
#
# 	Like CGIMapper, except it leaves a different marker to cause
# 	a different object to handle the request.
#
# ---
<Object>
	Name WinCGIMapper
	Class PathMapperClass
	PathInfo "Yes"
	Action "&dbreplace(response,string,ObjectMap,WinScripts)"
</Object>
<Object>
	Name FCGIMapper
	Class PathMapperClass
	PathInfo "Yes"
	Action "&dbreplace(response,string,ObjectMap,FastCGIScripts)"
</Object>

# ---
#
# AdminMapper
#
# For protected spaces
#
# ---
<Object>
	Name AdminMapper
	Class PathMapperClass

	# 
	# Set the authentication realm so the BasicAuth handler kicks in
	Action "&dbreplace(response,string,AuthenticationRealm,Admin)"
</Object>

# ---
#
# AccessLogger
#
#	An instance of ExpressionLoggerClass configured to generate an access
#	logfile
#
# ---
<Object>
	Name AccessLogger
	Class ExpressionLoggerClass

	#
	# Append
	#
	OpenMode "a"
	#
	# Line to log 
	Expression "$A $h - [$t] \"$r\" $s $b$M"
</Object>

# ---
#
# Start
#
#	Handle initial phases of requests, typically before we have enough
#	information to select different execution paths
#
# ---
<Object>
	Name Start
	Class FlexibleHandlerClass
	Init ReturnCode ReturnCode=COMPLETED
	Headers ReadRequestHeaders

	#
	# The handler 'VirtualHosts' is described below

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -