配置HTTP(Apache)服务器
2007-10-17 10:56
387 查看
[root@sample ~]# vi /etc/httpd/conf/httpd.conf ← 编辑Apache的配置文件 # # Don't give away too much information about all the subcomponents # we are running. Comment out this line if you don't mind remote sites # finding out what major optional modules you are running ServerTokens OS ← 找到这一行,将“OS”改为“Prod”(在出现错误页的时候不显示服务器操作系统的名称) ↓ ServerTokens Prod ← 变为此状态 # # Optionally add a line containing the server version and virtual host # name to server-generated pages (internal error documents, FTP directory # listings, mod_status and mod_info output etc., but not CGI generated # documents or custom error documents). # Set to "EMail" to also include a mailto: link to the ServerAdmin. # Set to one of: On | Off | EMail # ServerSignature On ← 找到这一行,将“On”改为“Off” ↓ ServerSignature Off ← 在错误页中不显示Apache的版本 # # ServerAdmin: Your address, where problems with the server should be # e-mailed. This address appears on some server-generated pages, such # as error documents. e.g. admin@your-domain.com # ServerAdmin root@localhost ← 将管理员邮箱设置为自己常用的邮箱 ↓ ServerAdmin yourname@yourserver.com ← 根据实际情况修改默认设置 # # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If this is not set to valid DNS name for your host, server-generated # redirections will not work. See also the UseCanonicalName directive. # # If your host doesn't have a registered DNS name, enter its IP address here. # You will have to access it by its address anyway, and this will make # redirections work in a sensible way. # #ServerName new.host.name:80 ← 修改主机名 ↓ ServerName www.centospub.com:80 ← 根据实际情况修改,端口号保持默认的80 # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs-2.0/mod/core.html#options # for more information. # Options Indexes FollowSymLinks ← 找到这一行,删除“Indexes”,并添加“Includes”、“ExecCGI” ↓ Options Includes ExecCGI FollowSymLinks ← 允许服务器执行CGI及SSI # # AddHandler allows you to map certain file extensions to "handlers": # actions unrelated to filetype. These can be either built into the server # or added with the Action directive (see below) # # To use CGI scripts outside of ScriptAliased directories: # (You will also need to add "ExecCGI" to the "Options" directive.) # #AddHandler cgi-script .cgi ← 找到这一行,去掉行首的“#”,并在行尾添加“.pl” ↓ AddHandler cgi-script .cgi .pl ← 允许扩展名为.pl的CGI脚本运行 # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None ← 找到这一行,将“None”改为“All” ↓ AllowOverride All ← 变为此状态,允许.htaccess # # The following directives define some format nicknames for use with # a CustomLog directive (see below). # LogFormat "%h %l %u %t /"%r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/"" combined ← 找到这一行 ↓ LogFormat "%h %l %u %t /"%!414r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/"" combined ← 改为此状态(添加“!414”到规则中,对于过长的日志不记录) # # Specify a default charset for all pages sent out. This is # always a good idea and opens the door for future internationalisation # of your web site, should you ever want it. Specifying it as # a default does little harm; as the standard dictates that a page # is in iso-8859-1 (latin1) unless specified otherwise i.e. you # are merely stating the obvious. There are also some security # reasons in browsers, related to javascript and URL parsing # which encourage you to always set a default char set. # AddDefaultCharset UTF-8 ← 找到这一行,在行首添加“#” ↓ #AddDefaultCharset UTF-8 ← 不使用UTF-8作为网页的默认编码 AddDefaultCharset GB2312 ← 并接着添加这一行(添加GB2312为默认编码) <Directory "/var/www/icons"> ← 找到这一个标签,并在标签中更改相应选项 Options Indexes MultiViews ← 找到这一行,将“Indexes”删除 ↓ Options MultiViews ← 变为此状态(不在浏览器上显示树状目录结构) AllowOverride None Order allow,deny Allow from all </Directory> [root@sample ~]# rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html ← 删除测试页 |
相关文章推荐
- Linux(CenOS7与RHEL7)下的Apache HTTP 服务器 2.4.29的安装与配置
- apache+mysql+php自定义配置中如何解决http500内部服务器错误
- SVN-1.5.3+Apache-2.0.59在windows下的配置与权限设置,以及配置HTTP方式访问SVN服务器
- Linux下Apache http 服务器安装配置
- 服务器 apache配置https,http强制跳转https
- 【异常】Android中使用localhost:8080或者172.0.0.1:8080访问本地服务器org.apache.http.conn.HttpHostConnectException异常
- Apache服务器SSL配置
- Tomcat+JK+Apache服务器多域名映射配置
- apache+php+mysql服务器环境配置注意点
- apache服务器的搭建配置以及正反向代理
- Apache服务器最新版下载、安装及配置(windows版)
- vs2015启动网站调试提示 HTTP 错误 403.14 - Forbidden Web 服务器被配置为不列出此目录的内容。 解决方法
- CentOS 5.4 服务器配置 yum安装Apache+php+Mysql+phpmyadmin
- 用Apache配置本地服务器,并用以运行html和Python文件
- Apache服务器的简单配置与安全策略
- windows下搭建Apache的php服务器配置方案
- 基于Apache的Svn服务器配置
- windows server 2003 svn 服务器安装及配置(无Apache)
- Apache服务器 配置多个网站解决方案
- Apache的配置文件http.conf参数含义详解