Configure the Apache service in RedHatLinux

Source: Internet
Author: User
1. check whether Apache service is installed # rpm-qa | grephttpd2.Apache service on the first installation disc # rpm-ivh/mnt/cdrom/RedHat/RPMS/httpd-2.0.40-21.i386.rpm3. configure the main directory of the Apache configuration document to modify the preceding content in the DocumentRoot "/var/www/html" Directory of line 289.

1. Check whether Apache service is installed # rpm-qa | grep httpd

2. the Apache service is installed on the first installation disc.
# Rpm-ivh/mnt/cdrom/RedHat/RPMS/httpd-2.0.40-21.i386.rpm

3. Configure Apache
Set the main directory of the document
DocumentRoot "/var/www/html"
Modify the content above
Set the default document format in line 408
DirectoryIndex index.html index. php
Note: Multiple default document types are separated by spaces.
Note that
If a document error occurs (for example, the HTTP 404 document in IIS is not found ),
A visitor can contact the network administrator for an e-mail address, which can be set to 259 rows.
ServerAdmin root @ localhost
Modify the content here
When domain name resolution is required, configure the 273 rows
# ServerName new. host. name: 80
Enter the DNS name here. If no DNS is used, enter the IP address as follows:
ServerName 192.168.0.1: 80
When DNS is entered here, it will be automatically overwritten when the virtual host is configured later.
The default character set sometimes displays Chinese characters as garbled characters. If this problem occurs, modify
772 rows
Adddefacharcharset GB2312
Change the original character set to GB2312, that is, the Chinese character set.
Configure the virtual directory.
The following is an example of Alias:
Before doing this, you need to create a virtual directory:
# Mkdir/var/www/xx
Modify the permissions of this folder:
# Chmod 755/var/www/xx
# Chmod 744/var/www/xx /*
Then edit httpd. conf.
Find the following in lines around 532:
Alias/icons/"/var/www/icons /"

Options Indexes MultiViews
AllowOverride None
Order allow, deny
Allow From all

Edit one as follows:
Alias/icons/"/var/www/x /"

Options Indexes MultiViews
AllowOverride None
Order allow, deny
Allow From all

Establish user authentication:
# Htpasswd-c/etc/httpd/mysecretpwd xx
New password:
Re-type new password:
Adding password for user xx
-C option indicates that the password file will be re-written and
Delete all original content. Therefore, when a second user is added to the password file
The-c parameter is not required, as shown below:
# Htpasswd/etc/httpd/mysecretpwd test
To enable authentication, edit the virtual directory:
Alias/icons/"/var/www/x /"

Options Indexes MultiViews
AuthType Basic
// The verification method is Basic.
AuthName "this webpage requires verification. Enter the password :"
// View the webpage as a prompt in the dialog box.
AuthUserFile/etc/httpd/mysecretpwd
// Set the path of the password file
Require user xx xx1
// Users allowed for access, separated by Spaces
AllowOverride None
Order allow, deny
Allow From all

If you need the VM service, find it at the end of this document.
# NameVirtualHost 123.456.789.123: 80 (or similar IP address)
Remove the previous # And set the IP address of your VM here.
At the end of the document, edit the following content:
// The IP address here is the IP address of the VM, and
The IP address after NameVirtualHost is the same,
ServerAdmin webmaster@root.localhost.com // WEB administrator email address
DocumentRoot/www/html // The website file storage location of the host
ServerName www.linuxidc.com // The server domain name, which can be an IP address

Start the Apache service:
#/Etc/init. d/httpd start
Restart the Apache service:
#/Etc/init. d/httpd restart
Stop the Apache service:
#/Etc/init. d/httpd stop

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.