Apache User Guide

Source: Internet
Author: User
Article title: Apache User Guide. 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.
With the increasing popularity of LINUX, many friends have installed REDHAT on their own computers, and began to explore REDHAT. I am here to tell you some of my experiences and hope to help you.
  
   Apache installation
Generally, you can choose to install the web server during installation and enable the httpd service in internet services, so that the system will automatically install apache, start the httpd process when the system starts for the first time. After some configuration, Open NETSCAPE in your Xwindows environment and enter localhost or local IP address in the URL to access the default apache page.
  
If you have not installed the web server, you can reinstall it and select UPDATE to install the apache software package on the local machine. Of course, if you want to install the latest version, you can download the latest version on the http://www.apache.org/website. If it is the original file, you need to configure it and then compile the original file. If you download a binary file, you can directly configure your WEB server. As for the compilation of the original file and the configuration work, we will not mention it for the moment. let's talk about the configuration process when apache is installed during system installation.
When the system starts, it starts the httpd service. The configuration has not been changed. httpd cannot start. The error "ServerName not idnetify" is reported. this is because no service name is specified in the default configuration. you can modify the configuration file manually. The specific method is:
1. edit the httpd. conf file in the/etc/httpd/conf/directory and find the ServerName parameter. this line is commented out (with the # symbol above ). Remove the \ "# \" symbol and enter your hostname or IP address.
2. start the httpd process again.
#/Etc/rc. d/init. d/httpd stop
#/Etc/rc. d/init. d/httpd start
Start netscape on the Xwindows interface, enter localhost or the local IP address in the URL, and you will be able to see a page of apache. from this page, you can take a look at the apache documentation, learn about it.
  
The process of such a home page is configured. you copy your home page to the/home/httpd directory, and then use netsacpe to access your host. then, you will find that your home page is displayed. Your home page is configured in this way. you only need to enter your IP address in your browser to access your home page. If you want to have a domain name, you have to apply for another domain name.
Note: When you access your page with NETSACPE, you can change the content in the default directory, however, no matter how you RELOAD your content in NETSCAPE, you cannot call your new content.
The reason for this is that NETSCAPE directly calls the content in the CACHE and does not actually read the content of your document. The solution is to clear the CACHE in NETSCAPE. The procedure is as follows:
1. select Edit from the menu.
2. select Preference at the bottom.
3. select Advanced from the menu on the left.
4. select Cache from the drop-down menu.
5. click the Clear Disk Cache and Clear Memory Cache buttons.
After clearing the netscape cache, you can see the updated page.
  
Http command line parameters
Httpd is an executable file located in the/usr/bin directory. With this command, we can manually start a WWW service so that others can access your home page. The specific parameters are as follows:
-D serverroot
This parameter tells httpd where to obtain the configuration parameters required for startup. serverroot is the command name for storing the configuration file.
-F config
The name of the configuration file. the default value is httpd. conf. If no directory is specified, the file will be retrieved from the serverroot directory.
-X
Start the single process mode. The idea is that you can only see the index.html page, and clicking the above link will not respond.
-V
The httpd version is displayed.
-L
Display the name of the module compiled into httpd.
-?
Show httpd parameters
After learning about the above parameters, we can start a service manually:
# Httpd? D/etc/httpd/mywebconf
The configuration file of your web server is stored in the/etc/httpd. mywebconf Directory. The following describes the name and content of the configuration file in the directory.
  
   Content and parameter meanings of the configuration file
There are three files in the configuration Directory:
1. conf/httpd. conf:
ServerType: two values are available: standalone and inetd.
Standalone:
Indicates your httpd process. it listens to the client requests in the background using a separate daemon.
Inetd:
It indicates that your httpd process does not run in daemon mode, but is listened by the Inetd internet services process, it automatically starts the httpd process to provide corresponding services.
The default mode is Standalone. if you are not familiar with ARPA Berkeley Services, do not change it.
Port: The Port number you allocated to your web server.
The default port of Httpd is 80. you can also assign a port number greater than 1024 to your web server. If you do this, you must follow your URL with your port number to access your page. For example, if the port number assigned to your service is 8888, you need to enter http: // domainname: 8888
ServerAdmin: the email address of the service administrator. the default address is the root user of the local machine, so it is root @ localhost.
ServerRoot: Directory used to store service configurations, errors, and record files.
BindAddress: the IP address of the VM. Use one machine to virtualize multiple machines.
ErrorLog: a file used to store error information of your web server.
TransferLog: used to store records of transferred file names.
PidFile: the specified file stores the httpd process ID to stop the web server.
ScoreBoardFile: used to store process information.
ServerName: the name of your machine. if you have a domain name, enter the domain name of your machine. If not, enter your host name or IP address.
Timeout: transmission or receipt delay. After this time, the SERVER disconnects the connection.
KeepAlive :( on or off) whether to allow multiple requests from one link at the same time.
KeepAliveTimeout: (default is 15) time to wait for the next request.
MaxClients: (default is 150) the maximum number of customers allowed.
Generally, the default values of the preceding parameters do not need to be changed. However, if you have several WEB servers on one SERVER at the same time, pay attention to them. First, you need to assign different port numbers to each web server. Second, specify their errorlog files and pidfile files respectively. Third, do not modify parameters that you do not understand. you must change the parameters at a time and keep records for recovery.
2./conf/access. conf:
It mainly sets the directory functions and access control. The following describes the configuration files of the default page. The file is located at/etc/httpd/conf/access. conf.
The uncommented part of the first section of the file is as follows:
  
Options Indexes IncludesNOEXEC
AllowOverride None
  
We have noticed that this part is based on Starting End. The content starting Indicates that the following settings are for the/home directory. The Options command has many parameters. the functions of each parameter are as follows:
All options except the MultiViews function.
ExecCGI enables the CGI program execution function.
FollowSymLinks enables a dynamic link. when a customer accesses this directory, the link is automatically linked to another related directory.
Enable the reference function of the server.
IncludesNOEXEC enables the reference function on the server, but # exec and CGI program references will be disabled.
If no index.html file is in the directory, the file list is displayed.
SymLinksIfOwnerMatch enables the link only when the target file or directory of the link is the same as the current directory.
Then there is the AllowOverride parameter, which sets access control. Set it to None, indicating that this function is not enabled.
The second part is:
  
Options Indexes Includes ExecCGI FollowSymLink
AllowOverride None
Order allow, deny
Allow from all
  
The third part is:
  
AllowOverride None
Options ExecCGI
  
Indicates that access control is not performed on/home/httpd/cgi-bin and CGI programs can be executed. This indicates that this is a directory used to store CGI programs.
  
3./conf/srm. conf
It is mainly used to specify the location of your document.
The first parameter is DocumentRoot. Specifies the address of the master document.
The second parameter is UserDir. Specifies the location of a personal homepage. If your home directory is/home/jon, enter http: // yourdomain/~ in the URL /~ The jon system will go to/home/jon/X/to retrieve the user's personal homepage. X is the directory specified by UserDir.
The third parameter is DirectoryIndex. Used to declare the name of the index file to be searched.
Other products are not modified or protected. The preceding options are usually used.
  
Example
You need to create a web server for startup. Assume that your document directory is/home/jon/html.
First, change the content of the/etc/httpd/conf/access. conf file. Change the original document directory to the new document directory.
For example:
  
   ?
Options Indexes Includes ExecCGI FollowSymLink
AllowOverride None
Order allow, deny
Allow from all
  
   ?
AllowOverride None
Options ExecCGI
  
Make the corresponding changes above. Note that/home/jon/cgi-bin is the directory of your cgi program.
Next, modify the/etc/httpd/conf/srm. conf file.
Change DocumentRoot/home/httpd/html to Docum
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.