In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the installation and configuration of apache httpd". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "the installation and configuration of apache httpd".
Installation package
Yum-y install httpd
Command
/ usr/sbin/httpd
Httpd: root:root lead process (master process)
Httpd: apche:ache worker process (work process)
Service
/ etc/init.d/httpd
Port:
80 tcp
443 ssl
The working root directory (equivalent to the program installation directory)
/ etc/httpd
/ etc/httpd/conf configuration file directory
/ etc/httpd/conf/httpd.conf main configuration file
/ etc/httpd/conf.d/*.conf these files are part of the main configuration file and are included with include in the main configuration file
/ etc/httpd/modules module directory
/ etc/httpd/logs-- > / var/log/httpd log directory
There are two types of log files: access _ log, error log: err_log
/ var/www/
Html static page directory
Cgi-bin
Welcome page:
/ etc/httpd/conf.d/welcome.conf
Do not display the welcome page
[root@LinuxTest named] # mv / etc/httpd/conf.d/welcome.conf / etc/httpd/conf.d/welcome.conf.bak
[root@LinuxTest named] # / etc/init.d/httpd restart
Stopping httpd: [OK]
Starting httpd: [OK]
Create a test page
Echo-e "
Hello world
Hello world
Welcome to our website
"> > / var/www/html/index.html
/ etc/httpd/conf/httpd.conf detailed explanation
It is mainly divided into three parts, the second part and the third part cannot be effective at the same time.
[root@LinuxTest named] # grep "Section" / etc/httpd/conf/httpd.conf
# Section 1: Global Environment
# Section 2: 'Main' server configuration
# Section 3: Virtual Hosts
Section 1:
The working directory of the ServerRoot "/ etc/httpd" server. Do not change it easily.
Wait timeout for unsuccessful establishment of Timeout 60 tcp connection
Whether KeepAlive Off uses persistent connections
Maximum number of requests per persistent connection for MaxKeepAliveRequests 100. zero means unlimited.
Length of disconnection of KeepAliveTimeout 15 long connections (in second)
MPM Multi Path Modules
Prefork A request is responded by a process
# StartServers: the number of processes that the number of server processes to start startup service is
# MinSpareServers: minimum number of idle processes in minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of idle processes in maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server specifies the online value of maxclients
# MaxClients: how many clients are allowed to connect at the same time in maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves the maximum number of requests per process
Worker A request is responded by a thread. Start multiple processes, each generating multiple threads
# StartServers: the number of processes in which initial number of server processes to start starts the service
# MaxClients: maximum number of maximum number of simultaneous client connections client connections
# MinSpareThreads: minimum number of worker threads which are kept spare minimum idle thread
# MaxSpareThreads: maximum number of worker threads which are kept spare maximum idle thread
# ThreadsPerChild: constant number of worker threads in each server process how many threads are generated by a process
# MaxRequestsPerChild: the number of requests per process in maximum number of requests a server process serves. 0 is unqualified.
Event one process processes multiple requests
Httpd-l lists the MPM models specified by the current httpd
Modify the startup default MPM model of HTTP
Vi / etc/sysconfig/httpd modify the configuration file of httpd
HTTPD=/usr/sbin/httpd.worker
The port on which the Listen 80 service listens. IP can be omitted. Not writing IP means listening to all addresses. Listen can have more than one
Section 2:
ServerAdmin root@localhost specifies the administrator email address, one for each site
The name of the ServerName www.example.com:80 server, which resolves IP to FQDN. Note: it is necessary in virtual hosts, especially those based on host names.
DocumentRoot "/ var/www/html" specifies the document root directory
Define the access rights of the root directory, etc.
Options Indexes FollowSymLinks is optional:
None does not support any options
Indexes (list the information in the directory, which is strongly not recommended in production, unless it is a download station)
Includes is not secure, allowing server-side inclusion (SSI)
FollowSymLinks follows symbolic links, allowing access to files pointed to by symbolic links. It is strongly not recommended to use the
SymLinksifOwnerMatch allows access to files executed by symbolic links, and is not recommended
ExecCGI allows execution of CGI scripts
MultiViews multi-function view (content negotiation mechanism), which is not recommended unless it supports multiple languages
All supports all options
AllowOverride None allows overrides, overriding the 2 options below. Optional: All,None,AuthConfig (based on account authentication)
Htpasswd creates a password file (Picture 2)
-c create a password file
-m md5 encryption
Htpasswd-c-m / etc/httpd/conf/htpasswd hadoop
Htpasswd-m / etc/httpd/conf/htpasswd hadoop
Order allow,deny order is used to define host-based access capabilities. (IP, network address or host-defined access control mechanism), allow and deny in order, order is critical
Allow from all
Or deny from all,allow from 192.168.56.0 go 24 (allow access to 56 network segments), or you can specify IP
DirectoryIndex index.html index.html.var specifies the default access page
It is not recommended whether HostnameLookups Off resolves IP to hostname in the log.
ErrorLog logs/error_log error log
LogLevel warn log level. Include: debug, info, notice, warn, error, crit,alert, emerg.
LogFormat specifies the log format
Section 3: (picture 3)
Profile syntax check: httpd-t checks profile syntax
Thank you for your reading, the above is the content of "installation and configuration of apache httpd", after the study of this article, I believe you have a deeper understanding of the installation and configuration of apache httpd, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.