Apache main directory structure and main configuration files

Source: Internet
Author: User
Tags builtin

1.apache directory Structure

[Email protected] apache]# Tree-l 1
.
|--Bin Program Command directory
|--Build
|--Cgi-bin
|--conf configuration file directory
|--Error
|--htdocs The Site directory when compiling the installation
|--icons
|--include
|--Lib
|--logs default log file storage includes error log (error_log) and access log (Access_log) tail-f Access_log can see access record at any time, inside Httpd.pid also record main process number
|--Mans
|--Manual
'--modules module directory such as PHP memcache compiled modules in this area

2. Bin directory

[Email protected] bin]# tree
.
|--AB Apache HTTP Server Performance Stress test tool, similar to JMeter LoadRunner Webbench
|--apachectl Apache Start command
|--Apr-1-config
|--Apu-1-config
|--APXS Apache server to compile and install the extension tools, in the DSO mode module compilation will be used for example, when compiling PHP used:--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS
|--Checkgid
|--Dbmmanage
|--Envvars
|--ENVVARS-STD
|--htcacheclean the command to clean up the disk buffers, generally less
|--htdbm
|--Htdigest
|--htpasswd Setup Update Basic authentication files such as configuring Nagio monitoring will be used
|--httpd for Apache Control command program, APACHECTL execution will call to httpd
|--httxt2dbm
|--Logresolve
'--rotatelogs Apache has its own log rotation tool, which can also be replaced with Cronolog.

3. conf Directory

[Email protected] conf]# tree
.
|--Extra Auxiliary Apache configuration file
| |--httpd-autoindex.conf
| |--httpd-dav.conf DAV Support configuration
| |--httpd-default.conf Apache related service configuration such as time-out time to stay connected
| |--httpd-info.conf
| |--httpd-languages.conf Language Support
| |--httpd-manual.conf
| |--httpd-mpm.conf Server pool management, such as Apache mode Configuration connection
| |--httpd-multilang-errordoc.conf
| |--HTTPD-SSL.CONF supports SSL encryption configuration
| |--httpd-userdir.conf
| '--httpd-vhosts.conf virtual machine configuration file
|--httpd.conf Master configuration file
|--Magic
|--Mime.types
'--Original

4. httpd.conf Master configuration file
[Email protected] apache]# egrep-v "#.*|^$"/usr/local/apache/conf/httpd.conf
ServerRoot "/usr/local/apache" Apache Run Directory
Listen 9911 Apache Port
<ifmodule!mpm_netware_module>
<ifmodule!mpm_winnt_module>
User Daemon Apache running users
Group Daemon Apache Run groups
</IfModule>
</IfModule>
ServerAdmin[email protected]Admin Mailbox
DocumentRoot "/usr/local/apache/htdocs" Site Directory index.html, pay attention to the last do not add/Line
<directory/> root directory permissions
Options FollowSymLinks can use symbolic links
AllowOverride None
Order Deny,allow
Deny from all
</Directory>
<directory "/usr/local/apache/htdocs" > Directory permissions Note Indexes's role is to allow directory browsing
Options Indexes FollowSymLinks
allowoverride None disables user-to-directory configuration files. htaccess modified, generally none
Order Allow,deny
Allow from all

</Directory>
<ifmodule dir_module>
DirectoryIndex index.html Site Directory Home file Multiple files separated by spaces
</IfModule>
<filesmatch "^\.ht" > Prevent Web users from viewing hidden files beginning with. HT
Order Allow,deny
Deny from all
Satisfy All
</FilesMatch>
Errorlog "Logs/error_log" error log
LogLevel Warn warning Level
<ifmodule log_config_module>
Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" Combined compound log format
Logformat "%h%l%u%t \"%r\ "%>s%b" common general log format
<ifmodule logio_module>
Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "%I%O" combinedio compound log format
</IfModule>
Customlog "Logs/access_log" Common default Access log format
</IfModule>
<ifmodule alias_module>
scriptalias/cgi-bin/"/usr/local/apache/cgi-bin/" CGI alias configuration
</IfModule>
<ifmodule cgid_module>
</IfModule>
<directory "/usr/local/apache/cgi-bin" > CGI access Path
AllowOverride None
Options None
Order Allow,deny
Allow from all
</Directory>
DefaultType Text/plain definition cannot determine MIME type when using default MIME type, if the service mainly contains text or HTML, Text/plain is a good choice
<ifmodule mime_module>
Typesconfig Conf/mime.types
AddType application/x-compress. Z allows information to be extracted in transit using mosaic/x 2.1+, but not all browsers support
AddType application/x-gzip. gz. tgz
</IfModule>
<ifmodule ssl_module>
Sslrandomseed Startup Builtin
Sslrandomseed Connect Builtin
</IfModule>


3. Virtual Host http_vhost.conf configuration file
Namevirtuahost *:80
Represents a name-based virtual host *:80 that provides HTTP services on 80 ports that monitor all IP on this computer, * can be set to a specific IP
<virtualhost *:80>
ServerAdmin Admin Mailbox
ServerName Domain name
Serveralias aliases can set multiple domains to point to the same site
Errorlog error Log
Customlog Access Log
</VirtualHost>
The configuration of the virtual host is a local priority principle, that is, the http_vhost.conf configuration, then it will not be read from the main configuration file http.conf

Example

Visit localhost,ok~

Problems encountered:

1. Server Native Access 403

Workaround: Add listen 80 listener to the httpd.conf file

2. Other LAN Machine access: You do not have permission to access/on the this server.

Workaround: Comment out the redundant virtual machine configuration items in http_vhosts.conf and access the Ip:port

3. Other LAN machine access, access to the real host has been the first page

Solution: http_vhosts.conf <virtualhost *:80> do not write <virtualhost localhost:80>

Article reference: http://www.woaidiannao.com/html/ITjs/fwqjs/6724.html

Apache main directory structure and main configuration files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.