Configuring Apache under "Linux" Linux

Source: Internet
Author: User

One. Access software: http://httpd.apache.org/httpd-2.4.10.tar.gz

Two. Installation steps:

Unzip the source file:

1) Tar zvxf httpd-2.4.10.tar.gz

2) CD httpd-2.4.10

3)./configure--prefix=/usr/local/apache2--enable-so--enable-rewrite

4) Make

5) make Install

Execute the./configure command to compile the source code.

--PREFIX=/USR/LOCAL/APACH2 is to set the system folder to which the compilation is installed.

--enable-s is a function that enables the HTTPD service to dynamically load modules

--enable-rewrite is a feature that enables the HTTPD service to have page address rewriting.

Three. Launch Apache:

/usr/local/apache2/bin/apachectl start


Four, verify the installation is successful

Direct input in the browser:http://localhost

Add the testp.php file to the/var/www/html and enter it in the browser: http://localhost/test.php


Five, add Apache to system services. Use the service command to control Apache startup and stop


First, build the Apache Service control script for the template with the Apachectl script:
Grep-v "#"/usr/local/apache2/bin/apachectl >/etc/init.d/apache

Edit Apache Service Control script/etc/init.d/apache with VI:
Vi/etc/init.d/apache

Insert the following line at the front of the file. To enable it to support the Chkconfig command:
#!/bin/sh
# chkconfig:2345 85 15
# Description:apache is a world Wide Web server.

Exit the VI editor after saving. Run the following command to add Apache Service Control script run permissions:
chmod +x/etc/init.d/apache

Run the following command to add the Apache service to the system service:
Chkconfig--add Apache

Run the following command to check if the Apache service is in effect:
Chkconfig--list Apache

The command output resembles the following result:
Apache 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Indicates that the Apache service is in effect. The execution level at 2, 3, 4, 5 starts with the system on its own initiative. You can later use the Service command to control the start and stop of Apache.

 

Start Apache services: Service Apache start
Stop Apache service: Service Apache stop
Run the following command to turn off boot: chkconfig Apache off

Configuring Apache under "Linux" Linux

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.