APACHE2

Jun 13, 2016 am 10:29 AM
httpd one Can start up exist Serve program

第二章 启动阿帕奇 2.1 启动阿帕奇 httpd 这支程序可以藉由网际网路服务程序 inetd 在每一次有连线要 进入 HTTP 服务的时候启动,或者另一种方式,它也可以作为服务程序 (daemon)持续地执行,处理请求。无论选择哪一种方式,都必须设定这 个 ServerType 指令告诉服务器它要如何执行。 2.2 命令列选项 下列选项可以用在 httpd 的命令列上: -d serverroot 把 ServerRoot 这个参数的起始值设定为 serverroot 。这可以 藉由在配置文件里面的 ServerRoot 命令来加以改变。此预设为 /usr/local/etc/httpd 。 -f config 启动时执行在 config 文件里面的指令。如果 config 没有以 / 作为开始的话,那麽它会被当作相对於 ServerRoot 的路径。此 预设值是 conf/httpd.conf 。 -X 以单一程序(single-process)模式执行,只用在内部除错;服务 程序不会脱离终端作业或是产生任何子程序。不要使用这个模式 来提供正常的网页服务。 -v 列印 httpd 的版本,然後结束。 -? 列印 httpd 选项的一份列表,然後结束。 2.3 配置档 此服务器将会读取三个配置指令文件。任何指令都可以出现在这些文件 任何一个里面。这些文件的名称是相对於服务器的根目录(server root) ; 这是根是藉由 ServerRoot 指令,或是 -d 这个命令列旗标所指定的。 依惯例这些文件是: conf/httpd.conf 包含控制服务程序运作的指令。文件名称可以配合 -f 命令列旗 旗标加以改变。 conf/srm.conf 包含控制服务器提供给客户端之文件规格的指令。文件名称可以 配合 ResourceConfig 指令加以改变。 conf/access.conf 包含控制文件之存取的指令。文件名称可以配合 AccessConfig 指令加以改变。 无论如何,这些惯例并不需要完全遵奉。 此服务器也会读取一个包含 MIME 文件型态的文件;这个文件名称藉由 TypesConfig 指令设定,而且有个 conf/mini.types 作为预设。 2.4 记录档 2.4.1 pid 档 服务程序启动时,它把父程序 httpd 的程序码(process id)存往这个 log/httpd.pid 文件。这个文件名称可以配合 PidFile 指令加以改变 。这个程序码由管理者用来重新启动或终止服务程序;一个 HUP 信号 会使服务程序重新读取其配置档而一个 TERM 信号会使它终止。 如果程序不正常地死掉(或被杀掉),那麽必须杀掉 httpd 子程序。 2.4.2 错误记录 服务器会将错误讯息记录到一个记录档去,预设为 log/error_log 。 文件名称可以藉由 ErrorLog 指令设定;可以为不同的虚拟主机设定不 同的错误记录。 2.4.3 传输记录 服务器一般会将每个请求记录到一个传输档,预设为 logs/access_log 。文件名称可以藉由 TransferLog 指令设定;可以为不同的虚拟主机 设定不同的传输记录。 第三章 阿帕奇核心部份(core)的特色 这些配置参数控制核心部份的阿帕奇特色,而且是固定可以使用的。 3.1 AccessConfig 指令 语法: AccessConfig 文件名称 预设: AccessConfig conf/access.conf 用於: server config, virtual host 状态: 核心 此服务器读取 ResourceConfig 文件之後将会继续读取这个文件以取得 更多指令。文件名称系相对於 ServerRoot 路径。此特色可以使用如下 的方式关闭: AccessConfig /dev/null 原本这个文件只包含 节区;事实上它现在可以包含任何 可以用於服务器配置的指令。 3.2 AccessFileName 指令 语法: AccessFileName 文件名称 预设: AccessFileName .htaccess 用於: server config, virtual host 状态: 核心 回传文件给客户端的时候,如果目录的存取控制档有启动,服务器会在 到达这份文件的路径中的每个目录里以此名称搜寻存取控制档。例如: AccessFileName .acl 在回传 /usr/local/web/index.html 这份文件前,此服务器将会读取 /.acl, /usr/.acl, /usr/local/.acl 以及 /usr/local/web/.acl 以 取得指令,除非以如下的方式关闭它们: AllowOverride None 3.3 AllowOverride 指令 语法: AllowOverride override override ... 预设: AllowOverride All 用於: directory 状态: 核心 服务器找到 AccessFileName 指定的文件时会需要知道该文件所宣告的 哪些指令可以改变稍早的存取资讯。 Override 可以设为 None 在此情况下服务器将不会读取该档,而设为 All 的话服务器将会允许所有的指令,或是下列其中之一: AuthConfig 允许验认指令的使用(AuthDBMGroupFile, AuthDBMUserFile, AuthGroupFile, AuthName, AuthType, AuthUserFile and require) FileInfo 允许控制文件型态之指令的使用(AddEncoding, AddLanguage, AddType, DefaultType and LanguagePriority) Indexes 允许控制目录索引之指令的使用(AddDescription, AddIcon, AddIconByEncoding, AddIconByType, DefaultIcon, DirectoryIndex, FancyIndexing, HeaderName, IndexIgnore, IndexOptions and ReadmeName) Limit 允许控制存取主机之指令的使用(allow, deny and order) Options 允许控制特定目录特色之指令的使用(Options and XbitHack) 3.4 AuthName 指令 语法: AuthName 验认领域 用於: directory, .htaccess 需求: AuthConfig 状态: 核心 这个指令为某个目录设定验认区域的名称。这个区域会送给客户端所以 使用者知道要传送的使用者名称以及密码。它必须藉由 AuthType 以及 require 指令来完成,而且要有像 AuthUserFile 以及 AuthGroupFile 这些指令配合运作。 3.5 AuthType 指令 语法: AuthType 型态 用於: directory, .htaccess 需求: AuthConfig 状态: 核心 这个指令为某个目录选择使用这验认型态。目前只有 Basic 实作出来 。它必须藉由 AuthName 以及 require 指令来完成,而且还要有像是 AuthUserFile 以及 AuthGroupFile 这些指令配合运作。 3.6 BindAddress 指令 语法: BindAddress 服务器位址 预设: BindAddress * 用於: server config 状态: 核心 一台 Unix 的 http 服务器可以监听到该服务机器每个 IP 位址的连线 或者只注意该服务机器的一个位址。服务器位址可以是: 。* 。一个 IP 位址 。一个完整的网际网路领域名称 如果此值是 * 的话,那麽该服务器将会监听每一个 IP 位址的连线, 否则它将只监听指定的 IP 位址。 这个选项可以用来作为另一种支援虚拟主机的方式取代 节段。 3.7 DefaultType 指令 语法: DefaultType mime-型态 预设: DefaultType text/html 用於: server config, virtual host, directory, .htacess 需求: FileInfo 状态: 核心 有些时候服务器会被要求提供某份文件,此文件不能藉由其 MIME 型态 对映来决定型态。 服务器必须知会客户端文件所包含的型态(content-type),所以不知道 型态的时候它便使用 DefaultType 。例如: DefaultType image/gif 对於包含许多没有 .gif 副文件名的 gif 图形目录是合适的。 3.8 指令 语法: ... 用於: server config, virtual host 状态: 核心 以及 用来把一组指令包装起来,这些指令 将只应用到所指明的目录及其子目录上。任何可以用於 directory 的 指令都可以使用。Directory 是到某目录的完整路径,或是替代字元串 (widecard string) 。在替代字元串中 `? 能够符合任何单一字元, 而 `* 能够符合任何顺序的一些字元。例如: Option Indexes FollowSymLinks 如果有多个 directory 节区能符合包含该文件的目录(或其父目录) ,那麽分布在 .htaccess 文件里的指令是以最短先符合的顺序加以应 用的,例如: AllowOverride None AllowOverride FileInfo 存取 /home/web/dir/doc.html 这份文件的步骤是: 。应用 AllowOverride None 指令(关掉 .htaccess 文件)。 。应用 AllowOverride FileInfo 指令(目录 /home/web )。 。应用任何在 /home/web/.htaccess 里面的 FileInfo 指令。 这个 directory 节段典型是用在 access.conf 文件里,但它们可以 出现在任何配置档里。 指令不能巢状使用,而且不能出现 在 节段里。 3.9 DocumentRoot 指令 语法: DocumentRoot 目录名称 预设: DocumentRoot /usr/local/etc/httpd/htdocs 用於: server config, virtual host 状态: 核心 这个指令设定 httpd 从这个目录提供文件服务。除非符合像是 Alias 这样的指令,服务器把所要求的 URL 附加到文件根 (document root) 来组合到达文件的路径。例如: DocumentRoot /usr/web 如此对於 http://www.my.host.com/index.html 文件的存取便会参照 到 /usr/web/index.html 。 3.10 ErrorDocument 指令 语法: ErrorDocument 错误代码 文件 用於: server config, virtual host 状态: 核心 有问题或错误发生的状况下,可以配置阿帕奇做四种反应 1. 如同 NCSA httpd 1.3 的反应 2. 输出自定的(customized)讯息 3. 重导到某个本地的 URL 以处理该问题/错误 4. 重导到某个外部的 URL 以处理该问题/错误 2-4 是使用 ErrorDocument 来配置,其後跟随 HTTP 反应码以及讯息 或是 URL 。 ErrorDocument 500 /cgi-bin/tester ErrorDocument 404 /cgi-bin/bad_urls.pl ErrorDocument 401 http://www.foo.bar/subscription_info.html ErrorDocument 403 "Sorry cant allow you acess today 参阅: 自定回应的文件。 3.11 ErrorLog 指令 语法: ErrorLog 文件名称 预设: ErrorLog logs/error_log 用於: server config, virtual host 状态: 核心 这个错误记录指令设定文件名称,服务器将会把其遭遇的每个错误记录 到这个文件去。如果文件名称不是以 / 开始的话那麽它就会被假设为 相对於 ServerRoot 的路径。例如: ErrorLog /dev/null 这会有效地关掉错误记录。 3.12 Group 指令 语法: Group unix-群组 预设: Group #-1 用於: server config 状态: 核心 这个 Group 指令设定服务器回答要求时所处的群组。为了要能够使用 这个指令,必须以 root 身分起始执行独立的服务器。 Unix-群组可以 是这些其中之一:

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to make Google Maps the default map in iPhone How to make Google Maps the default map in iPhone Apr 17, 2024 pm 07:34 PM

The default map on the iPhone is Maps, Apple's proprietary geolocation provider. Although the map is getting better, it doesn't work well outside the United States. It has nothing to offer compared to Google Maps. In this article, we discuss the feasible steps to use Google Maps to become the default map on your iPhone. How to Make Google Maps the Default Map in iPhone Setting Google Maps as the default map app on your phone is easier than you think. Follow the steps below – Prerequisite steps – You must have Gmail installed on your phone. Step 1 – Open the AppStore. Step 2 – Search for “Gmail”. Step 3 – Click next to Gmail app

How to solve the computer prompt 'reboot and select proper boot device' How to solve the computer prompt 'reboot and select proper boot device' Jan 15, 2024 pm 02:00 PM

Reinstalling the system may not be a foolproof solution, but after reinstalling, I found that when the computer is turned on, it will display white text on a black background, and then give a prompt: rebootandselectproperbootdevice, what is going on? Such a prompt is usually caused by a boot error. In order to help everyone, the editor has brought you a solution. Computer use is becoming more and more popular, and computer failures are becoming more and more common. No, recently some users encountered a black screen when turning on the computer, and prompted Reboot and Select Proper Boot device, and the computer system could not start normally. What's going on? How to solve it? The user is confused. Next, the editor will follow

What should I do if wps cannot start the source application of this object? What should I do if wps cannot start the source application of this object? Mar 13, 2024 pm 09:13 PM

WPS is a very widely used office software, including documents, forms and PPT, and supports multi-terminal synchronization. If the prompt "The source application for this object cannot be launched" appears when editing wps, how to solve it? This problem may occur because you are trying to open a link or file, but its source application no longer exists or has been deleted. Here are some fixes: 1. Reinstall WPS software: Try reinstalling WPSOffice to fix the problem and make sure you are using the latest version. 2. Manually change the default program: Try to change the default program to WPS. You can right-click the file you want to open, select "Open with", and then

The first choice for CS players: recommended computer configuration The first choice for CS players: recommended computer configuration Jan 02, 2024 pm 04:26 PM

1. Processor When choosing a computer configuration, the processor is one of the most important components. For playing games like CS, the performance of the processor directly affects the smoothness and response speed of the game. It is recommended to choose Intel Core i5 or i7 series processors because they have powerful multi-core processing capabilities and high frequencies, and can easily cope with the high requirements of CS. 2. Graphics card Graphics card is one of the important factors in game performance. For shooting games such as CS, the performance of the graphics card directly affects the clarity and smoothness of the game screen. It is recommended to choose NVIDIA GeForce GTX series or AMD Radeon RX series graphics cards. They have excellent graphics processing capabilities and high frame rate output, and can provide a better gaming experience. 3. Memory power

Clock app missing in iPhone: How to fix it Clock app missing in iPhone: How to fix it May 03, 2024 pm 09:19 PM

Is the clock app missing from your phone? The date and time will still appear on your iPhone's status bar. However, without the Clock app, you won’t be able to use world clock, stopwatch, alarm clock, and many other features. Therefore, fixing missing clock app should be at the top of your to-do list. These solutions can help you resolve this issue. Fix 1 – Place the Clock App If you mistakenly removed the Clock app from your home screen, you can put the Clock app back in its place. Step 1 – Unlock your iPhone and start swiping to the left until you reach the App Library page. Step 2 – Next, search for “clock” in the search box. Step 3 – When you see “Clock” below in the search results, press and hold it and

Which one to choose when starting wallpaperengine? Which one to choose when starting wallpaperengine? Mar 19, 2024 am 08:49 AM

When wallpaperengine starts, there are 4 different options. Many users don't know which one to choose when starting wallpaperengine. Generally, when wallpaperengine starts, choose the first one: start 32-bit. Which one to choose when starting wallpaperengine? Answer: Start 32-bit. 1. Generally, when wallpaperengine starts, select the first one: start 32-bit. 2. When wallpaperengine starts, there are 4 different options: start 32-bit; start 64-bit. 3. Start 32-bit: This is a generally recommended option and suitable for most users. 4. Start 64-bit: If the system supports 64-bit, you can choose this option

How to set the boot priority of Apple dual system How to set the boot priority of Apple dual system Feb 19, 2024 pm 06:49 PM

As technology continues to develop, the need to use different operating systems is becoming more and more common. For Apple users, sometimes you may need to install and use two different operating systems on one device, such as macOS and Windows. In this case, it is particularly important to set the startup sequence of the dual system. This article will introduce how to set up Apple devices to start the dual system first when turning on the device. First, we need to make sure that both operating systems have been successfully installed on the Apple device. You can use BootCamp this Apple

Can't allow access to camera and microphone in iPhone Can't allow access to camera and microphone in iPhone Apr 23, 2024 am 11:13 AM

Are you getting "Unable to allow access to camera and microphone" when trying to use the app? Typically, you grant camera and microphone permissions to specific people on a need-to-provide basis. However, if you deny permission, the camera and microphone will not work and will display this error message instead. Solving this problem is very basic and you can do it in a minute or two. Fix 1 – Provide Camera, Microphone Permissions You can provide the necessary camera and microphone permissions directly in settings. Step 1 – Go to the Settings tab. Step 2 – Open the Privacy & Security panel. Step 3 – Turn on the “Camera” permission there. Step 4 – Inside, you will find a list of apps that have requested permission for your phone’s camera. Step 5 – Open the “Camera” of the specified app

See all articles