Introduction to Web server setup in Linux

Source: Internet
Author: User
Tags http authentication
Article Title: Web server setup in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Today, let's take a look at how to rack Web servers in Linux.
  
In LINUX, there are three common methods: CERN, NCSA, and Apache. Apache is the most commonly used method. This method has obvious features, simple configuration, and maximum system compatibility. The following describes how to configure a Linux-based WEB server.
  
   1. Apache server overview.
  
Its features are remarkable: it can run on all computer platforms, including UNIX/LINUX systems, integration of proxy servers and Perl programming scripts, and tracking of user access sessions; server logs can be customized; Virtual Hosts and HTTP authentication are also supported. In combination with the powerful LINUX system, we have no reason not to choose Apache.
  
   2. install Apache.
  
Generally, all Linux versions should contain the installation of this software package. If you have not installed this software package on the Linux system, you can find the installation file on the installation disc or http://www.apache.org/website (note that there are two versions online: one is the source code that needs to be re-compiled after download, the other is the executable file that can be used only after decompression), and then the installation can be executed.
  
1. if you download an executable file package, for example, apache_1.2.4.e.tar.gz (the number in the package depends on the version you downloaded, for example), it is relatively simple, it is suitable for beginners who are not familiar with Linux compilation. You only need to execute tar xvzf apache_1.2.3.4.tar.gz to complete the installation.
  
2. If the source code such as apache_1.2.4.rpm is downloaded, use rpm first? Install ivh apache_1.2.4.rpm and run ". /configure "; then run the" make "command to compile Apache; then copy the compiled executable file to the/etc/httpd/bin directory; and then run the Apache configuration file: httpd. conf, access. conf, srm. conf and mime. if types is copied to the/etc/httpd/conf directory, the installation is complete.
  
   3. Configure Apache to implement WEB services.
  
In fact, your Linux has already started WEB services. All you need to do is connect the Linux system to the Internet and store the home page in the "/home/httpd" directory. However, to make the WEB server work more efficiently, we still need to make some settings for it. The specific configuration is actually the four files just copied. The two main configuration files httpd. conf and access. conf are described as follows:
  
1. httpd. conf.
This file is the main configuration file, mainly used to set the basic environment for server startup, that is, it is responsible for arranging how the WEB server runs. The related parameters are as follows:
  
ServerType standalone/inetd: This option specifies the method in which the WEB server runs. The standalone parameter indicates that a WEB service process listens for client requests in the background in a separate waiting process. If yes, a sub-process is generated to serve the WEB Service. This is more efficient. It mainly sets the specific Port address for the master server process to listen. The method is Port [number] (80 by default ).
  
The inetd mode is safer than standalone mode, which is also the default mode for running Apache in RedHat Linux. If your version is not RedHat, add the following line to the/etc/inetd. conf file: httpd stream tcp nowait httpd/etc/httpd/bin/httpd? F/etc/httpd/conf/httpd. conf; then Add a new line: httpd 80/tcp httpd in the/etc/services file.
  
ErrorLog: used to specify the file name and path of the error log. The format is ErrorLog/var/httpd/error. log.
ServerRoot: specifies where the server configuration and log files are stored. Format: ServerRoot/etc/httpd.
Server Admin: Set the WEB administrator's e-mail address. Format for example: Server Admin XXX@XXXX.com.
  
2. srm. conf
This is the Apache resource configuration file. It is used to tell the server what resources you want to provide on the WWW site and how to provide them. The main parameters are as follows:
  
DocumentRoot: used to specify the address of the master document. The format is DocumentRoot/home/httpd/html.
DirectoryIndex: Same as IIS settings on windows platform, it is used to specify the name of the home page file. Everyone knows that the first page generally uses "index.html?or" index.htm "as the file name. After these two file names are set, you only need to send a webrequest to access the homepage named "index.html?or index.htm. Format: DirecotryIndex index.html index.htm.
  
After the preceding simple configuration, your WEB server has basic functions. The next step is to restart the WEB service to make the configuration take effect. We can use the following command to complete it:
  
/Etc/rc. d/init. d/httpd restart
  
Finally, let's take a look at the security aspects based on the Apache service. Through the authentication system, the Apache server can control which hosts can access certain websites. Specifically, it is implemented in two ways:
  
One is host address-based authentication, but most online users currently use dynamic addresses, so this method has little practical significance;
  
Another authentication method is based on the user name/password. It is self-evident that this method is more suitable for today's network conditions. The specific implementation of user name/password authentication is not covered in this article, you can refer to relevant materials for further study.
Related Article

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.