Installation and configuration of Apache for Web services

Source: Internet
Author: User

"Apache HTTP Server" is an outstanding representative of open source software projects, the official name is "httpd", in the Web server field for a long time to maintain more than half of the quota, can be used in Linux, UNIX, Windows and other operating system platforms


The main features of Apache

(1) Open source code

(2) Cross-platform applications

(3) Support for various web programming languages

(4) Modular design

(5) Stable operation

(6) Good safety


Installing the HTTPD server

? ? HTTPd Server Installation method can choose RPM installation, source code compiled installation two ways, but the former in the function of some limitations, more is to use the source code compiled installation. We download the source code package httpd-2.217.tar.gz As an example, describes the httpd service of the custom installation process?

Reference address http://httpd.apache.org/download.cgi?


(1) Preparatory work

? ? The HTTPD service may have been installed on some servers using RPM, and it is recommended to uninstall the previous httpd service and related dependencies in order to avoid problems such as port conflicts, program conflicts, etc.

[[email Protected]?~]#?rpm?-e?httpd?httpd-manual?webalizer?subversion?mod_python?mod_ssl?mod_perl?] System-config-httpd?php?php-cli?php-ldap?php-common?mysql?dovecot?--Nodeps


(2) Source code compilation and installation


? ? In the configuration, each option has the following meanings:

--prefix: Specifies the directory under which the HTTPD service is installed

--ENABLE-SO: Enable dynamic load module support, which is the ability of the HTTPD service to further expand functionality

--enable-rewrite: Enable Web page address rewriting capability for site optimization and directory Migration maintenance

--enable-charset-lite: Enable character set support for Web pages that support a variety of character set encodings

--ENABLE-CGI: Enable CGI scripting support to extend application access to your Web site


(3) Confirm the installation result

? ? Because the installation directory is specified, the various programs, modules, and Help files for the httpd service are copied to this directory


? ? The main sub-directories are used as follows:

/usr/local/httpd/bin: Various execution Program files for HTTPD service, including main program httpd, Service Control tool APACHECTL, etc.

/USR/LOCAL/HTTPD/CONF: Store httpd Services Various configuration files, including Master profile httpd.conf, enhanced configuration subdirectory extra, etc.

/usr/local/httpd/htdocs: Store Web documents, including default home file index.html, etc.

/usr/local/httpd/logs: Log file to store httpd service

/usr/local/httpd/modules: Various module files for storing httpd services

/usr/local/httpd/cgi-bin: Storing various CGI program files


(4) Optimize execution path

? ? Because the HTTPD service is compiled by source code, the program path is not in the default search path and can be used to make the service more convenient to use and to add symbolic links to related programs.


(5) Add httpd system service

To add httpd to system services for management through chkconfig, you need to create a controlled script file


? ? Upon successful execution, the HTTPD service will run automatically every time the system enters 3 or 5 levels. You can use the Apachectl tool to control the HTTPD service, or you can use the/ETC/INIT.D/HTTPD script to start the HTTPD server program



Basic configuration of the HTTPD server

(1) Determine the website name, IP address (slightly)

? ? This will not be written, the previous document has described the detailed steps. Configure the IP address to 192.168.1.1, the site name is www.ysf.com, and bind service is enabled


(2) Configure and start the HTTPD service

1) Configure HTTPD service

? ? Edit HTTPd's Master Profile httpd.conf, locate the configuration item "ServerName", modify one line of content to set the name of the site

[[Email protected]?~]#?vim?/usr/local/httpd/conf/httpd.conf


? ? After modifying the httpd.conf file, it is recommended to use "apachectl-t" or "httpd-t" to check the configuration, if there is an error, you need to correct the configuration according to the error message


2) Start httpd service


(3) deploying Web page Documents

? ? The Web site root directory is located by default under/usr/local/httpd/htdocs, you need to copy or upload a Web page document to this directory, httpd default provides a index.html test page, as a test page when visiting the site


(4) Accessing the Web site at the client

? ? By default, the Iptables firewall intercepts HTTP traffic, so the iptables service needs to be shut down


(5) Viewing the Web site's access status


? ? In this way, a simple Web server is built successfully, the following describes the next httpd.conf configuration file details


httpd.conf configuration file

(1) Global configuration Items

?? The following lists the most common global configuration items in the httpd.conf file:


(2) Regional configuration items


? ? In the above zone, a zone configuration for the root directory is set, where the configuration is valid only for the root zone and does not work on other directory regions


? ??

Installation and configuration of Apache for Web services

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.