Apache configuration, apache

Source: Internet
Author: User

Apache configuration, apache

The yum source of centos for redhat6.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!

 

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:

 

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

Http://www.cnblogs.com/xiaobo-Linux/p/4630944.html

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.