Configuring the Apache Server

Source: Internet
Author: User

Environment: centos6.5

Configuration file Interpretation

#根目录: Used to store Apache configuration files and related log information
ServerRoot "/usr/local/apache"

#设置服务器监听的端口
Listen 80
Listen 8080
#注意可以设置多个监听端口, the port number of the ServerName must be chosen to be declared here.


#设置管理员邮件地址
ServerAdmin [email protected]

#设置主机名称
ServerName www.example.com:80
#如果没有域名, you can use an IP address
#ServerName 1.2.3.123:80
#注意这里的端口号必须从上面的Listen那一项中声明的端口号中选取, or it will fail.
#也可以省略端口, you can access it whenever you use any of the ports declared in Listen
#ServerName www.test.com:8080

#设置错误日志
Errorlog "/usr/log"

#设置文档目录
DocumentRoot "/home/wwwroot/"
#文档目录是指包含web网站源代码的那个目录

#设置首页
DirectoryIndex index.html index.php
#这个首页是指客户端访问网站的时候首先看到的页面文件名, this file should be in the DocumentRoot directory.
#可以设置多个文件名, you will try again in turn, and stop trying if you try to succeed

#设置网站的编码格式 (GB2312 or UTF-8)
Adddefaultcharset UTF-8

Note: Directories use double quotes to enclose the path.

Case: A Web server needs to be built within the department with the following requirements:
    1. The IP address and port used are 192.168.1.80:80
    2. Home using index.html file
    3. Admin e-mail address [email protected]
    4. The website is encoded in GB2312
    5. All site resources are placed in the "/var/www/html" directory
    6. Set Apache's root directory to "/etc/httpd" directory

Configuring the Apache 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.