Apache configuration in RedHat Linux 6.4

Source: Internet
Author: User

Apache configuration in RedHat Linux 6.4

RedHat yum source of CentOS for Linux 6.4 Enterprise Edition.

Install and configure apache.

1. install Apache online on yum

Generally, you do not use yum for online installation because if apache breaks down, the yum installation package may depend on the installation package.

Yum online installation command: yum install httpd *-y

2. Start the httpd service

Command:/etc/init. d/httpd restart

Cause:

You need to modify the host domain name.

Modify the file: vi/etc/hosts

Restart:/etc/init. d/httpd restart.

3. Configure the publishing file and directory

The default directory is/var/www/html.

The corresponding file is index.html.

You can first write a home page and put it below: vi/var/www/html/index.html

Write a few sentences.

To access this server: Enter the IP address in the address bar of the browser.

Inaccessible!

This involves the firewall problem!

Run iptables-nL.

Run iptables-F.

Iptables-nL

You can try again!

However, in this case, you must disable the firewall, so you need to configure the firewall:

Open the iptables configuration file vi/etc/sysconfig/iptables.

Add a port 80:

-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT

That's all!

Set your own release directory below (if you do not need the default directory/var/www/html /)

Run vi/etc/httpd/conf/httpd. conf.

Edit this file:

Comment out the original default directory and change it to your own directory. Input content.

Then, create the release directory and the release file mkdir-p/home/web/in the modified directory/

Edit index.html in vi/home/web/index.html.

Restart the httpd service:/etc/init. d/httpd restart

However, this interface is displayed:

Because selinux has insufficient permissions, we must set the security context of the default release directory:

Install software for security context modification:

Enter the command: yum install policycore *-y

Modify the security context of/home/web

Enter the command: semanage foontext-a-t httpd_sys_content_t '/home (/.*)? '

Restorecon-RvvF/home/

Check the security context of/home/web. The security context is indeed accessible:

Then you can access the IP Address:

Start Apache automatically upon startup:

Vim etc/rc. local and add/etc/init. d/httpd restart!

Finally, how to access the vro's subip address through the Internet:

You need to configure the port ing lan ip address in the vro.

Allow Internet access to intranet port forwarding

Install a Web Server on Ubuntu Server 14.04 (Linux + Apache + MySQL + PHP)

Install and configure the PHP environment in Linux (Apache2)

How to enable Apache Rewrite in Ubuntu

Key points after upgrading Apache 14.04 to 2.2 in Ubuntu 2.4

Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)

Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind

Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment

Apache details: click here
Apache: click here

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.