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/02 Report--
Share the configuration and management methods of apache server under CentOS (Linux). Friends who need it can refer to it. I. WEB Server and Apache
1. Web server and URL
2. The history of Apache
3. Supplement
Http://www.netcraft.com/ can view the market share of apache servers.
At the same time, it must be noted that ngnix is in a rising period of strong growth, and it has the feeling of competing with apache, which is really awesome.
II. Management commands of Apache server
1. Command startup: service httpd start/stop/restart/reload/condrestart/status/configtest/graceful/help
2. Start the script: / etc/init.d/httpd start/stop/.
3. Set it to start automatically: ntsysv+ spacebar
III. Directories and files of the Apache server
1. WEB site directory
Directory of / var/www Apache site files
/ var/www/html stores the WEB file of the WEB site
/ var/www/cgi-bin CGI program file
/ var/www/html/manual Apache WEB http://www.bbqmw.net/ Server Manual
2. Configuration file
.htaccess directory-based configuration file, which contains access control instructions for files in its directory
/ etc/httpd/conf/httpd.conf Apache WEB server configuration file directory
3. Startup script
/ startup script for the etc/rc.d/init.d/httpd WEB server daemon
/ etc/rc.d/rc3.d/S85httpd connects the run-level directory (/ etc/rc3.d) to the startup script in the directory / etc/rc.d/init.d
4. Application file
/ usr/sbin location where Apache WEB server program files and applications are stored
/ usr/doc/ places Apache WEB server documents
/ var/log/http location where Apache log files are placed
IV. More orders
1. View Apache installation information: apachectl-C
2. Check the syntax of the Apache configuration file: apachectl-t
3. Check the Apache compilation configuration parameter: apachectl-V
4. Check the compilation module of Apache: apachectl-l
5. Httpd.conf configuration file
(1) basic configuration
The httpd.conf file contains the following three parts:
1. Global environment settings: the part that controls the behavior of the entire Apache server (that is, global environment variables)
two。 Master server configuration: an instruction that defines the main or default service parameters, and also provides default setting parameters for all virtual hosts
3. Virtual host settings: setting parameters of virtual host
Among them, a line cannot be written down using "\" to indicate a new line, all option instructions are not case-sensitive except for the parameter values of the option, and "#" indicates a comment.
Now, let's learn about the specific settings in httpd.conf:
1. Set the path relative to the root directory
The relative root directory is usually the place where the configuration files and log files are stored in Apache. Usually, the relative root directory is "/ etc/httpd", which generally contains conf and logs subdirectories, which can be set in the format "ServerRoot" / etc/httpd ".
2. Set the IP address and port number for Apache listening
By default, Apache listens for client requests on TCP 80 on all available IP addresses on the machine, and you can use the list statement to listen for requests on a specified address and port. For example, if you set the server to listen only on port 80 of 192.168.0.94, you can set it in httpd.conf: Listen 192.168.0.94 Listen 80. If you need to change the port number to 8080, you can also use settings such as "Listen 192.168.0.94 8080", but when you access the website through a web browser, you must also add the corresponding port number after the domain name address, for example, enter "http://192.168.0.94:8080" to access." Note: the IP of my virtual machine Linux is 192.168.0.94 and the IP of Magi windows is 192.168.0.225.
3. Set the email address of the network administrator
When an error occurs when the client computer accesses the server, the server usually returns the error prompt page to the client computer. In order to solve the error, this web page usually contains the administrator's e-mail address. At this time, you can use the ServerAdmin statement to set the administrator's e-mail address, such as "ServerAdmin xinyuan365@sohu.com".
4. Set the server host name
To make it easier for Apache to identify the server's own information, you can use the ServerName statement to set the host name of the server. In the ServerName statement, fill in the domain name of the server if it has a domain name, or the IP address of the server if there is no domain name. For example, "ServerName 192.168.0.94 virtual 80".
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.