Install and configure Apache 9.0 in RedHat Linux 2.2

Source: Internet
Author: User

Environment: VMware Workstation 7.1 + RedHat Linux 9.0

Installation steps:

1. Download The apache2.2.18.tar.gz installation package;

2. copy to the root directory: # cp apache2.2.18.tar.gz ~

3. Go to the root directory, decompress: cd, press enter, tar-xvzf apache2.2.18.tar.gz, and decompress

4. Go to the apache2.2.18 directory.

5. Run the following command to install: #./configure -- prefix =/usr/local/apache2 -- this is the installation directory.

# Make

# Make install

6. Go to the apache installation directory: cd/usr/local/apache2/bin to start the apache service: sh apachectl start

7. Check whether the test is successful. Enter http: // serverip in the browser to display that it works is successful.

Simple Configuration:

1. Go to the directory cd/usr/local/apache2/conf.

2. Edit the configuration file httpd. conf: vi httpd. conf.

3. Enter/ServerName and press enter to locate the ServerName location, modify the host name ServerName 192.168.223.small: 80 (note: this IP address is your own host), save and exit: wq

4. Go to the directory:/usr/local/apache2/htdocs to modify the index.html file.

5. Modify the hosts file: vi/etc/hosts add 192.168.223.20.linuxidc.net --- use it to log on

6. If you log on to windows, you must modify the hosts file in windows: % systemroot % 3/windows/system32/drivers/etc. Open and modify the file in notepad.

7. Enter the http://www.myhack58.net in IE to display the Step 4 modified index.html webpage

Note: logon may fail to be displayed. You can disable the linux Firewall: service iptables stop.

About the Virtual Host Configuration:

The main configuration file is located in the httpd-vhosts.conf file under the/usr/local/apache2/conf/extra directory

Premise: 1. Remove Include conf/extra/httpd-vhosts.conf line comment in the main configuration file httpd. conf;

2. comment out the content between <Directory> and </Directory>, that is, add #

3. differentiate virtual hosts with different domain names, such as www.2cto.com and ww.myhack58.net.

Procedure:

1. Enter the/usr/local/apache2/conf/extra directory to edit the httpd-vhosts.conf file or create a new one, first back up the original file

2. Back up the original file: cp httpd-vhosts.conf httpd-vhosts.conf.bak

3. Edit httpd-vhosts.conf: vi httpd-vhosts.conf

4. Modification content:

NameVirtualHost 192.168.223.small: 80


<VirtualHost 192.168.223.small: 80>
ServerName www.2cto.com
DocumentRoot "/usr/local/apache2/htdocs/www.2cto.com" -- create one if the directory does not exist
Directoryindex index.html -- this file is created in the www.2cto.com directory.

<Directory "/usr/local/apache2/htdocs/www.2cto.com">

Options None
AllowOverride None
Order allow, deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.223.small: 80>
ServerName www.myhack58.net
DocumentRoot "/usr/local/apache2/htdocs/www.myhack58.net" -- create a directory if the directory does not exist
Directoryindex index.html -- this file is created in the www.myhack58.net directory.

<Directory "/usr/local/apache2/htdocs/www.myhack58.net">
Options None
AllowOverride None
Order allow, deny
Allow from all
</Directory>
</VirtualHost>

5. Save and exit and restart the service.

/Usr/local/apache2/bin/apachectl stop

/Usr/local/apache2/bin/apachectl start

6. Add domain name resolution in the/etc/hosts and hosts files in windows

192.168.223.20.www.2cto.com

192.168.223.20.www.myhack58.net

7. Enter www.2cto.com and www.myhack58.net in the browser to display different webpages.

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.