Home > 備忘録 > Apache に関すること > apache の設定( 82 )
[root@server]# yum -y install httpd ←Apacheインストール
[root@server]# yum -y install php php-mbstring ←Aphp,php-mbstringインストール[root@server]# vi /etc/httpd/conf/httpd.conf
#
# 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
↓
ServerTokens Prod
# 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 abcdef@leom.mydns.jp
# 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 www.example.com:80
↓
ServerName leom.mydns.jp:80
<Directory \"/var/www/html\">
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
↓
Options Includes ExecCGI FollowSymLinks
# 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
↓
AllowOverride All
# 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 ← 長すぎるURI(414エラー)はログに記録しない
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
SetEnvIf Request_URI \"default\.ida\" no_log ← 追加(アクセスをログに記録しない)
SetEnvIf Request_URI \"cmd\.exe\" no_log ← 〃
SetEnvIf Request_URI \"root\.exe\" no_log ← 〃
SetEnvIf Request_URI \"Admin\.dll\" no_log ← 〃
SetEnvIf Request_URI \"NULL\.IDA\" no_log ← 〃
SetEnvIf Remote_Addr 192.168.66 no_log ← 追加(内部からのアクセスをログに記録しない)
SetEnvIf Remote_Addr 127.0.0.1 no_log ← 追加(自ホストからのアクセスをログに記録しない)
CustomLog logs/access_log combined env=!no_log ← 上記以外のアクセスをログに記録する
# 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
↓
ServerSignature Off
AddDefaultCharset UTF-8
↓
#AddDefaultCharset UTF-8 ← コメントアウト
#AddHandler cgi-script .cgi
↓
AddHandler cgi-script .cgi .pl ← CGIスクリプトに.plを追加[root@server]# /etc/rc.d/init.d/httpd start
[root@server]# systemctl start httpd.service ←Feodora16以降[root@server]# chkconfig httpd on
[root@server]# systemctl enable httpd.service ←Feodora16以降