CentOS 7 Installation Appache Server

Source: Internet
Author: User
Tags website ip fully qualified domain name

first, the installation of Apache programs, generally there are three ways to install:
1. Direct network installation;
2. Download the RPM package and upload it to the server for installation;
3. Compile the installation through the original code; yum-y Install Httpdrpm-qa | grep httpd Start/stop/restart/status service httpd start
Service httpd Stop
Service httpd Restart
Service httpd Status
Pstree | grep httpd//Verify that the service is started, less used, and at startup, if prompted with the following information:
Starting httpd:httpd:Could not reliably determine the server's fully qualified domain name, using Localhost.localdomain for S Ervername Edit/etc/httpd/conf/httpd.conf
Find the following:
#ServerName www.example.com:80
Change to
ServerName localhost:80 re-start the Apache service;------------------------------test if the installation configuration is successful HTTP://IP address if it comes out: Apache 2 test Page Powered by the CentOS description is OK, simple, if not open, it should be iptables problem;
Edit/etc/sysconfig/iptables
Add the following content:
-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 443-j accept and then restart Iptables service available;------------------------------ two basic configuration:1. Setting Project for Host environment edit/etc/httpd/conf/httpd.confkeepalive off
Change to
KeepAlive onmaxkeepaliverequests 100
Change to
Maxkeepaliverequests 500//To improve the efficiency can be changed a little;
Startservers 8
Minspareservers 5
Maxspareservers 20
Serverlimit 256
MaxClients 256
Maxrequestsperchild 4000
Startservers 4
MaxClients 300
Minsparethreads 25
Maxsparethreads 75
Threadsperchild 25
Maxrequestsperchild 2 execution modules, using the Prefork module by default, if you want to use the worker module to edit the following files:
/etc/sysconfig/httpd
Look for the following:
#HTTPD =/usr/sbin/httpd.worker
Change to
Httpd=/usr/sbin/httpd.worker then restart the Apache service,------------------------------2. Edit/etc/httpd/conf/for Chinese BIG5 encoding language Httpd.conf found the following:
Adddefaultcharset UTF-8
Change to
#AddDefaultCharset UTF-8
Or
Adddefaultcharset gb2313//According to the actual situation, find the following content:
Languagepriority en CA cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-br Ru SV ZH-CN ZH-TW
Change to
Languagepriority ZH-CN en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-br RU SV ZH-TW Then restart Apache service then;- -----------------------------3. For home permissions Related settings Edit/etc/httpd/conf/httpd.conf find the following:
Options Indexes FollowSymLinks
Change to
Options followsymlinks MultiViews then restart Apache service,------------------------------ Advanced Configuration:

The website IP is illegally pointed out by others ' domain name? How Apache prohibits malicious domain names from pointing to your server IP:

Workaround One: Create a new Virtual host: <virtualhost *:80>
ServerName 171.111.158.91//Change the IP address of your own server;
<location/>
Order Allow,deny
Deny from all
</Location>
</VirtualHost> workaround Two: Create a new virtual host (the domain name that is not defined by default accesses the contents of the first virtual host): <virtualhost *:80>
DirectoryIndex index.html index.htm index.php
Documentroot/var/www/html/test//Define an empty directory, or a page that displays the site you need to indicate in this directory;<directory/var/www/html/test>
ServerName 171.111.158.91//Change the IP address of your own server;
Catalogue ibid.
Order Allow,deny
Allow from all
</Directory>
</VirtualHost> Source: http://www.linuxidc.com/Linux/2014-01/95256.htm

CentOS 7 Installation Appache Server

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.