Using Apache to build Web services (i)

Source: Internet
Author: User
Tags character set iis web services linux

There are two common ways to build Web servers in today's Internet, one is IIS and one is Apache. As you all know, IIS is a Microsoft product and is only supported on Windows systems. So what do we do when we want to build a Web server in a Linux system? Yes, we use Apache. Apache is open source software, and can be used across platforms, but also support a variety of Web page format, so it is used in a number of Linux systems.

Apache Features: Open soft code, can be used across platforms, support a variety of web language, can be modular deployment.

Install HTTPD Server Software

Before you configure the Apache Web service, you need to properly install the httpd server software. There are two ways to install, RPM installation and compile installation, the former relatively simple, fast, but there are some limitations in the function, in the actual production environment, the use of the source code to compile and install the way to be more common. Before installation, if the system has previously installed HTTPD service needs to uninstall it, so that the program, port conflicts.

We can get the latest version from the http://httpd.apache.org website.

[Root@localhost Media] #tar zxf httpd-2.2.17.tar.gz-c/usr/src///Extract the source package into the/usr/src/directory

[Root@localhost Media] #cd/usr/src/httpd-2.2.17/

[Root@localhost httpd-2.2.17]#./configure--prefix=/usr/lcoal/httpd--enable-so--enable-rewrite-- Enable-charset-lite--enable-cgi//configuration HTPD installation options

[Root@localhost httpd-2.2.17] #make && make Install//compilation and installation

In the above configuration command, the options have the following meanings:

--prefix: Specifies the installation path of the HTTPD service program.

--ENABLE-SO: Enable dynamic load module support.

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

--enable-charset-lite: Initiates character set support to support Web pages encoded using a variety of character sets.

--ENABLE-CGI: Enables CGI script support to expand the application access capabilities of the Web site.

The associated subdirectories are generated in the "/USR/LOCAL/HTTPD" directory when the installation is complete.

The following are some of the more common subdirectories:

/usr/local/httpd/bin/: A variety of procedures for storing httpd services, including the main program httpd, service control tools Apachectl, and so on.

/usr/lcoal/httpd/conf/: A variety of configuration files that store httpd services.

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

/usr/local/httpd/logs/: Store the httpd log file.

/usr/local/httpd/modules/: A variety of module files for storing httpd services.

/usr/lcoal/httpd/cgi-bin/: Storage of various CGI program files.

Compile the installed HTTPD service through the source code, the program path is not in the default search path, in order to make the service more convenient in use, you can add symbolic links for related programs.

[Root@localhost/] #ln-S/usr/local/httpd/bin/*/usr/lcoal/bin

It can also be added as a system service and managed using the Chkconfig command.

[Root@localhost/] #cp/usr/local/httpd/bin/apachectl/etc/init.d/httpd

[Root@localhost/] #vim/etc/init.d/httpd

#!/bin/bash

#chkconfig: 35 85 15

#description: Startup script for the Apache HTTP Server

.../omit part of the content

[Root@localhost/] #chkconfig--add httpd

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.