Apache服务器配置全攻略(6)
通常连接时, 服务器 仅仅可以得到客户机的IP地址,如果要想获得客户机的 主机名,以进行日志记录和提供给 CGI程序使用,就需要使用这个HostnameLookups 选项,将其设置为On打开DNS反查功能。但是这将使 服务器 对每次客户请求都进行DNS查询,增加了系统开销
通常连接时,服务器仅仅可以得到客户机的IP地址,如果要想获得客户机的主机名,以进行日志记录和提供给 CGI程序使用,就需要使用这个HostnameLookups 选项,将其设置为On打开DNS反查功能。但是这将使服务器对每次客户请求都进行DNS查询,增加了系统开销,使得反应变慢,因此缺省设置为使用Off关闭此选项。关闭选项之后,服务器就不会获得客户机的主机名,而只能使用IP地址来记录客户。
ErrorLog /var/log/httpd-error.log
LogLevel warn
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent} "" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
#CustomLog /var/log/httpd-access.log common
#CustomLog /var/log/httpd-referer.log referer
#CustomLog /var/log/httpd-agent.log agent
CustomLog /var/log/httpd-access.log combined
这里定义了系统日志的形式,对于服务器错误记录, 由ErrorLog、 LogLevel 来定义不同的错误日志文件及其记录内容。
对于系统的访问日志,缺省使用CustomLog参数定义日志的位置,缺省使用 combined 参数指定将所有的访问日志放在一个文件中,然而也可以将不同种类的访问日志放在不同的日志记录文件中,这是通过在 CustomLog中指定不同的记录类型来完成的。common表示普通的对单页面请求访问记录,referer表示每个页面的引用记录,可以看出一个页面中包含的请求数,agent表示对客户机的类型记录,显然可以将现有的 combined 定义的设置行注释掉,并使用common、referer和agent作为CustomLog的参数,来为不同种类的日志分别指定日志记录文件。
显然,LogFormat是用于定义不同类型的日志进行记录时使用的格式, 这里
使用了以%开头的宏定义,以记录不同的内容。
如果这些参数指定的文件使用的是相对路径,那么就是相对于ServerRoot的
路径。
ServerSignature On
一些情况下,例如当客户请求的网页并不存在时,服务器将产生错误文档,
缺省情况下由于打开了 ServerSignature选项,错误文档的最后一行将包含服务器的名字、Apache的版本等信息。有的管理员更倾向于不对外显示这些信息,就
可以将这个参数设置为Off,或者设置为Email,最后一行将替换为对 ServerAdmin 的Email提示。
Alias /icons/ "/www/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Alias参数用于将URL与服务器文件系统中的真实位置进行直接映射,一般的
文档将在DocumentRoot 中进行查询,然而使用Alias定义的路径将直接映射到相
应目录下,而不再到DocumentRoot 下面进行查询。因此Alias可以用来映射一些
公用文件的路径,例如保存了各种常用图标的icons路径。这样使得除了使用符号连接之外,文档根目录(DocumentRoot)外的目录也可以通过使用了Alias映射,提供给浏览器访问。
定义好映射的路径之后,应该需要使用Directory语句设置访问限制。
ScriptAlias /cgi-bin/ "/www/cgi-bin/"
AllowOverride None
Options None
Order allow,deny
Allow from all
ScriptAlias也是用于URL路径的映射,但与Alias的不同在于,ScriptAlias 是用于映射CGI程序的路径,这个路径下的文件都被定义为CGI程序,通过执行它们来获得结果,而非由服务器直接返回其内容。缺省情况下CGI程序使用cgi-bin目录作为虚拟路径。
# Redirect old-URI new-URL
Redirect参数是用来重写URL的,当浏览器访问服务器上的一个已经不存在的资源的时候,服务器返回给浏览器新的URL,告诉浏览器从该URL中获取资源。这主要用于原来存在于服务器上的文档,改变了位置之后,而又希望能使用老URL能访问到,以保持与以前的URL兼容。
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz
ReadmeName README
HeaderName HEADER
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
当一个HTTP请求的URL为一个目录的时候,服务器返回这个目录中的索引文件。但如果一个目录中不存在缺省的索引文件,并且该服务器又许可显示目录文件列表的时候,就会显示出这个目录中的文件列表,为了使得这个文件列表能具有可理解性,而不仅仅是一个简单的列表,就需要前面的这些设置参数。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Concurrency testing and debugging Concurrency testing and debugging in Java concurrent programming are crucial and the following techniques are available: Concurrency testing: Unit testing: Isolate and test a single concurrent task. Integration testing: testing the interaction between multiple concurrent tasks. Load testing: Evaluate an application's performance and scalability under heavy load. Concurrency Debugging: Breakpoints: Pause thread execution and inspect variables or execute code. Logging: Record thread events and status. Stack trace: Identify the source of the exception. Visualization tools: Monitor thread activity and resource usage.

To add a server to Eclipse, follow these steps: Create a server runtime environment Configure the server Create a server instance Select the server runtime environment Configure the server instance Start the server deployment project

1. Background of the Construction of 58 Portraits Platform First of all, I would like to share with you the background of the construction of the 58 Portrait Platform. 1. The traditional thinking of the traditional profiling platform is no longer enough. Building a user profiling platform relies on data warehouse modeling capabilities to integrate data from multiple business lines to build accurate user portraits; it also requires data mining to understand user behavior, interests and needs, and provide algorithms. side capabilities; finally, it also needs to have data platform capabilities to efficiently store, query and share user profile data and provide profile services. The main difference between a self-built business profiling platform and a middle-office profiling platform is that the self-built profiling platform serves a single business line and can be customized on demand; the mid-office platform serves multiple business lines, has complex modeling, and provides more general capabilities. 2.58 User portraits of the background of Zhongtai portrait construction

There are a variety of attack methods that can take a website offline, and the more complex methods involve technical knowledge of databases and programming. A simpler method is called a "DenialOfService" (DOS) attack. The name of this attack method comes from its intention: to cause normal service requests from ordinary customers or website visitors to be denied. Generally speaking, there are two forms of DOS attacks: the third and fourth layers of the OSI model, that is, the network layer attack. The seventh layer of the OSI model, that is, the application layer attack. The first type of DOS attack - the network layer, occurs when a large number of of junk traffic flows to the web server. When spam traffic exceeds the network's ability to handle it, the website goes down. The second type of DOS attack is at the application layer and uses combined

To successfully deploy and maintain a PHP website, you need to perform the following steps: Select a web server (such as Apache or Nginx) Install PHP Create a database and connect PHP Upload code to the server Set up domain name and DNS Monitoring website maintenance steps include updating PHP and web servers, and backing up the website , monitor error logs and update content.

According to news from this website on July 23, ASUS has launched a variety of server and workstation-level products powered by AMD EPYC 4004 series processors. Note from this site: AMD launched the AM5 platform and Zen4 architecture EPYC 4004 series processors in May, offering up to 16-core 3DV-Cache specifications. ASUSProER100AB6 server ASUSProER100AB6 is a 1U rack server product equipped with EPYC Xiaolong 4004 series processor, suitable for the needs of IDC and small and medium-sized enterprises. ASUSExpertCenterProET500AB6 workstation ASUSExpertCenterProET500AB6 is a

KubernetesOperator simplifies PHP cloud deployment by following these steps: Install PHPOperator to interact with the Kubernetes cluster. Deploy the PHP application, declare the image and port. Manage the application using commands such as getting, describing, and viewing logs.

How to Implement PHP Security Best Practices PHP is one of the most popular backend web programming languages used for creating dynamic and interactive websites. However, PHP code can be vulnerable to various security vulnerabilities. Implementing security best practices is critical to protecting your web applications from these threats. Input validation Input validation is a critical first step in validating user input and preventing malicious input such as SQL injection. PHP provides a variety of input validation functions, such as filter_var() and preg_match(). Example: $username=filter_var($_POST['username'],FILTER_SANIT
