Home Backend Development PHP Tutorial Conversion of APACHE configuration file httpd.conf to 3_PHP tutorial

Conversion of APACHE configuration file httpd.conf to 3_PHP tutorial

Jul 13, 2016 pm 05:28 PM
ad apache about of Configuration file

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为一个目录的时候,服务器返回这个目录中的索引文件。但如果一个目录中不存在缺省的索引文件,并且该服务器又许可显示目录文件列表的时候,就会显示出这个目录中的文件列表,为了使得这个文件列表能具有可理解性,而不仅仅是一个简单的列表,就需要前面的这些设置参数。 如果使用了Index Options Fancy Indexing文件使用哪种图标,则使用 下面的 AddIconByEncoding、AddIconByType以及AddIcon来定义,分别依据MIME 的编码、类型以及文件的后缀来判断使用何种图标。如果不能确定文档使用的图标,就使用 DefaultIcon服务器还在目录下,查询使用ReadmeName和HeaderName定义的文件(自动加上 . html后缀,如果没有发现,再使用.txt后缀进行搜索),如果发现了这些文件, 就在文件列表之前首先显示这些文件的内容,以使得普通目录列表具备更大的可 理解性。   IndexIgnore让服务器在列出文件列表时忽略相应的文件, 这里使用模式配 置的方式定义文件名。 AddEncoding x-compress Z AddEncoding x-gzip gz  AddEncoding用于告诉一些使用压缩的MIME类型,这样可以让浏览器进行解压缩操作。 AddLanguage en .en AddLanguage fr .fr AddLanguage de .de AddLanguage da .da AddLanguage el .el AddLanguage it .it LanguagePriority en fr de   一个HTML文档可以同时具备多个语言的版本,如对于file1.html文档可以具 备file1.html.en、file1.html.fr 等不同的版本,每个语言后缀必须使用 AddLanguage进行定义。这样服务器可以针对不同国家的客户,通过与浏览器进行协商,发送不同的语言版本。而LanguagePriority 定义不同语言的优先级,以便在浏览器没有特殊要求时,按照顺序使用不同的语言版本回应对file1.html 的请求。 这个国际化的能力实际的应用并不多。 #AddType application/x -httpd-php .phtml #AddType application/x-httpd-php-source .phps  AddType参数可以为特定后缀的文件指定MIME类型,这里的设置将覆盖 mime.types中的设置。   #AddHandler cgi-script .cgi AddHandler是用于指定非静态的处理类型,用于定义文档为一个非静态的文 档类型,需要进行处理,再向浏览器返回处理结果。例如上面注释中的设置是将以.cgi结尾的文件设置为cgi-script类型,那么服务器将启动这个CGI程序以进行处理。如果需要在前面AliasScript定义的路径之外执行CGI程序,就需要使用这个参数进行设置,此后以.cgi结尾的文件将被当作CGI程序执行。   在配置文件、这个目录中的.htaccess以及其上级目录的.htaccess中必须允许执行CGI程序,这需要通过Options ExecCGI参数设定。 #AddType text/html .shtml #AddHandler server-parsed .shtml   另外一种动态进行处理的类型为server-parsed,由服务器自身预先分析网页内的标记,将标记更改为正确的HTML标识。由于server-parsed需要对text/html 类型的文档进行处理,因此首先定义了对应的.shtml为text/html类型。  然而要支持SSI,还要首先要在配置文件(或.htaccess)中使用Options IncludesOptions IncludesNOExec让执行普通的SSI标志,但不执行其中引用的外部程序。Another way to specify the server-parsed type is to use the XBitBack setting option. If XBitHack is set to On, the server will check all text/html type documents (including documents with the .html suffix). If it is found that the file attribute has the execution bit " x", the server considers it to be a server analysis document and needs to be processed by the server. It is recommended to use AddHandler for settings and set XBitBack to Off, because using XBitBack will perform additional checks on all HTML documents, reducing efficiency. #AddHandler send-as-is asis #AddHandler imap-file map #AddHandler type-map var The AddHandler commented above is used to support the asis, map and var processing capabilities of the Apache server. # Action media/type /cgi-script/location # Action handler-name /cgi-script/location Because the processing functions provided internally by Apache are limited, you can use Action to define external programs for the server as dynamic document types that can be processed. These external The program is the same as the standard CGI program. It processes the input data and then outputs the results of different MIME types. For example, to define an operation that first executes wri2txt to process the special suffix wri and then returns the result, you can use: Action windows-writer /bin/wri2txt AddHandler windows-writer wri Further, you can directly use Action to define a certain MIME The type is processed in advance, which requires the Action parameter setting method in the first format in the example. This setting method no longer requires an additional AddHandler to associate the processing operation with the file suffix, but uses Action to directly process MIME type files. But if the document suffix does not have a formal MIME type, you need to define a MIME type first. #MetaDir .web #MetaSuffix .meta Meta information is sent to the client's browser before the document is sent to the client. Therefore, the browser can access this Meta information through the HEAD request without actually returning all the document data through GET. The server usually sends some standard HTTP header information to the browser. If you want to add additional information, you need to use MetaDir to define the directory where the Meta data is stored, and MetaSuffix is ​​used to specify the suffix of the file containing Meta data. #ErrorDocument 500 "The server made a boo boo. #ErrorDocument 404 /missing.html #ErrorDocument 404 /cgi-bin/missing_handler.pl #ErrorDocument 402 http://some.other_server.com/subscription_info.html   If the web page requested by the customer When a situation such as non-existence or lack of access rights occurs, the server will generate an error code and will also respond to the client's browser with a web page identifying the error. ErrorDocument is used to set the content that should be responded to by the client's browser when an error occurs. The first parameter of ErrorDocument is the error sequence number, and the second parameter is the response data, which can be simple text, local web page, local CGI program, and web page on the remote host. BrowserMatch "Mozilla/2" nokeepalive BrowserMatch "MSIE. 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch "RealPlayer 4.0" force-response-1.0 BrowserMatch "Java/1.0" force-response-1.0 BrowserMatch "JDK/1.0" force-response-1.0 The BrowserMatch command is specific The client program sets special parameters to ensure compatibility with older browsers and support new features of new browsers. # # SetHandler server-status # Order deny,allow # Deny from all # Allow from .your_domain.com. # # # SetHandler server-info # Order deny,allow # Deny from all # Allow from .your_domain.com # # # Deny from all # ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi is used to set access control The settings are mainly for directories and files, but you can also set access control for different URLs, so you don't have to worry about whether ScriptAlias ​​and Alias ​​set the path outside the controlled directory. The statement that controls the URL is the Location statement, which not only protects files and CGI on the server, but also protects special function URLs that cannot find the corresponding files but are provided by the server itself. http://servername/server-status is used to report the current status of the Apache server, and http://servername/server-info is used to report the statistical information of the Apache server. Related settings include the ExtendedStatus parameter, which allows the server to output a more detailed report. # #ProxyRequests On # # # Order deny,allow # Deny from all # Allow from .your_domain.com # #ProxyVia On #CacheRoot "/www/proxy" #CacheSize 5 #CacheGcInterval 4 #CacheMaxExpire 24 #CacheLastModifiedFactor 0.1 #CacheDefaultExpire 1 # NoCache a_domain.com another_domain.edu joes.garage_sale.com # The Apache server itself has the proxy function, but this requires the mod_proxy module to be loaded. This can be determined using the IfModule statement. If the mod_proxy module exists, use ProxyRequests to turn on proxy support. The following Directory is used to set access permission settings to the Proxy function, as well as to set various parameter settings for buffering. Virtual Host #NameVirtualHost 12.34.56.78:80 #NameVirtualHost 12.34.56.78 # # ServerAdmin webmaster@host.some_domain.com # DocumentRoot /www/docs/host.some_domain.com # ServerName host.som

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/531827.htmlTechArticleIndexOptions FancyIndexing AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip AddIconByType (TXT,/icons/text.gif) text/* AddIconByType (IMG,/icons/image2.gif) image/*...
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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1262
29
C# Tutorial
1235
24
How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to view your apache version How to view your apache version Apr 13, 2025 pm 01:15 PM

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to view the apache version How to view the apache version Apr 13, 2025 pm 01:00 PM

How to view the Apache version? Start the Apache server: Use sudo service apache2 start to start the server. View version number: Use one of the following methods to view version: Command line: Run the apache2 -v command. Server Status Page: Access the default port of the Apache server (usually 80) in a web browser, and the version information is displayed at the bottom of the page.

How to solve the problem that apache cannot be started How to solve the problem that apache cannot be started Apr 13, 2025 pm 01:21 PM

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.

How to configure zend for apache How to configure zend for apache Apr 13, 2025 pm 12:57 PM

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

How to delete more than server names of apache How to delete more than server names of apache Apr 13, 2025 pm 01:09 PM

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

See all articles