Webサーバー(Apache)の管理と設定(http.conf) – Linux
あっ!10月10日は萌えの日だ。
初期状態で「Apache」というWebサーバープログラムがインストールされています。
Webサーバーを構築する場合はApacheの設定を行います。
実は、ここにもWebARENA SuitePRO V2 から マイティーサーバー ライトプラン へサーバーを移転した理由が潜んでいます。
WebARENA SuitePRO V2 では、同時に実行できるプロセス数に制限があり128程度にするように推奨されていました。
※Apacheの同時に起動するプロセス数は初期値が256に設定されています。
安定したWebサーバー運用の為にチューニングをするってな時に、制限がないって事でマイティーサーバーの専用レンタルサーバーの方が、ちょっぴり気分が良かったりします。
Webサーバー(Apache)の起動
# /etc/init.d/httpd start
httpd を起動中: [ OK ]
Webサーバー(Apache)のバージョン確認
# httpd -v
Server version: Apache/2.2.3
Webサーバー(Apache)の自動起動開始
# chkconfig httpd on
Webサーバー(Apache)の不要動的モジュール組み込み停止
# mv auth_mysql.conf auth_mysql.conf.090802
# mv auth_pgsql.conf auth_pgsql.conf.090802
# mv mailman.conf mailman.conf.090802
# mv manual.conf manual.conf.090802
# mv proxy_ajp.conf proxy_ajp.conf.090802
# mv python.conf python.conf.090802
# mv squid.conf squid.conf.090802
# mv webalizer.conf webalizer.conf.090802
# mv welcome.conf welcome.conf.090802
Webサーバー(Apache)の設定ファイル修正
# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.100801
※おまえさん。以下の設定値に関しては必ず適当に読み替えて下さいな♥
vi /etc/httpd/conf/httpd.conf
### Section 1: Global Environment ServerTokens ProductOnly ServerRoot "/etc/httpd" PidFile run/httpd.pid Timeout 120 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 ## ## Server-Pool Size Regulation (MPM specific) ## # prefork MPMStartServers 8 MinSpareServers 5 MaxSpareServers 20 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 4000 # worker MPMStartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 Listen 80 # # Dynamic Shared Object (DSO) Support # #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_alias_module modules/mod_authn_alias.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so #LoadModule authn_default_module modules/mod_authn_default.so #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so #LoadModule authz_default_module modules/mod_authz_default.so #LoadModule authz_groupfile_module modules/mod_authz_groupfile.so #LoadModule autoindex_module modules/mod_autoindex.so #LoadModule cache_module modules/mod_cache.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule dav_module modules/mod_dav.so #LoadModule deflate_module modules/mod_deflate.so #LoadModule disk_cache_module modules/mod_disk_cache.so #LoadModule expires_module modules/mod_expires.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule info_module modules/mod_info.so #LoadModule ldap_module modules/mod_ldap.so #LoadModule logio_module modules/mod_logio.so #LoadModule mem_cache_module modules/mod_mem_cache.so #LoadModule mime_magic_module modules/mod_mime_magic.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule speling_module modules/mod_speling.so #LoadModule status_module modules/mod_status.so #LoadModule userdir_module modules/mod_userdir.so #LoadModule usertrack_module modules/mod_usertrack.so LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule authn_file_module modules/mod_authn_file.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_owner_module modules/mod_authz_owner.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule cgi_module modules/mod_cgi.so LoadModule dir_module modules/mod_dir.so LoadModule env_module modules/mod_env.so LoadModule headers_module modules/mod_headers.so LoadModule include_module modules/mod_include.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule suexec_module modules/mod_suexec.so LoadModule vhost_alias_module modules/mod_vhost_alias.so # Load config files from the config directory "/etc/httpd/conf.d". Include conf.d/*.conf User apache Group apache ### Section 2: 'Main' server configuration #ServerAdmin root@localhost ServerAdmin admin@example.com UseCanonicalName Off DocumentRoot "/var/www/html"Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all UserDir disable #UserDir public_html #DirectoryIndex index.html index.html.var DirectoryIndex index.html index.shtml index.php index.cgi index.html.var AccessFileName .htaccessOrder allow,deny Deny from all TypesConfig /etc/mime.types DefaultType text/plain# MIMEMagicFile /usr/share/magic.mime MIMEMagicFile conf/magic HostnameLookups Off #EnableMMAP off #EnableSendfile off ErrorLog logs/error_log LogLevel warn LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent SetEnvIf Request_URI ^/default\.ida no_log SetEnvIf Request_URI ^/NULL\.IDA no_log SetEnvIf Request_URI cmd\.exe no_log SetEnvIf Request_URI root\.exe no_log SetEnvIf Request_Method "(GET)|(POST)|(PUT)|(DELETE)|(HEAD)" !no_log SetEnvIf Request_URI owssvr\.dll no_log SetEnvIf Request_URI cltreq\.asp no_log SetEnvIf Request_URI "\.(txt)|(gif)|(jpeg)|(jpg)|(png)|(css)$" no_log SetEnvIf Remote_addr 192.168.0. no_log #Home #SetEnvIf Remote_addr 192.168.0.1 no_log #etc... #SetEnvIf User-Agent "Baiduspider" AGENT no_log SetEnvIf User-Agent "NaverBot" AGENT no_log SetEnvIf User-Agent "psbot" AGENT no_log SetEnvIf User-Agent "iaskspider" AGENT no_log SetEnvIf User-Agent "Accoona-AI-Agent" AGENT no_log SetEnvIf User-Agent "Shim-Crawler" AGENT no_log SetEnvIf User-Agent "QihooBot" AGENT no_log SetEnvIf User-Agent "Twiceler" AGENT no_log SetEnvIf User-Agent "ICC-Crawler" AGENT no_log SetEnvIf User-Agent "YodaoBot" AGENT no_log SetEnvIf User-Agent "Yeti" AGENT no_log SetEnvIf User-Agent "MJ12bot" AGENT no_log SetEnvIf User-Agent "BecomeJPBot" AGENT no_log SetEnvIf User-Agent "Steeler" AGENT no_log SetEnvIf User-Agent "DotBot" AGENT no_log SetEnvIf User-Agent "WebDataCentreBot" AGENT no_logorder allow,deny allow from all deny from env=AGENT deny from 220.181.34. deny from 124.115.0. deny from 64.124.85. #CustomLog logs/access_log combined CustomLog logs/access_log combined env=!no_log #ServerSignature On ServerSignature Off #Alias /icons/ "/var/www/icons/" # # Options Indexes MultiViews # AllowOverride None # Order allow,deny # Allow from all # #ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" ## AllowOverride None # Options None # Order allow,deny # Allow from all # IndexOptions FancyIndexing VersionSort NameWidth=* AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip AddIconByType (TXT,/icons/text.gif) text/* AddIconByType (IMG,/icons/image2.gif) image/* AddIconByType (SND,/icons/sound2.gif) audio/* AddIconByType (VID,/icons/movie.gif) video/* AddIcon /icons/binary.gif .bin .exe AddIcon /icons/binhex.gif .hqx AddIcon /icons/tar.gif .tar AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip AddIcon /icons/a.gif .ps .ai .eps AddIcon /icons/layout.gif .html .shtml .htm .pdf AddIcon /icons/text.gif .txt AddIcon /icons/c.gif .c AddIcon /icons/p.gif .pl .py AddIcon /icons/f.gif .for AddIcon /icons/dvi.gif .dvi AddIcon /icons/uuencoded.gif .uu AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl AddIcon /icons/tex.gif .tex AddIcon /icons/bomb.gif core AddIcon /icons/back.gif .. AddIcon /icons/hand.right.gif README AddIcon /icons/folder.gif ^^DIRECTORY^^ AddIcon /icons/blank.gif ^^BLANKICON^^ DefaultIcon /icons/unknown.gif #AddDescription "GZIP compressed document" .gz #AddDescription "tar archive" .tar #AddDescription "GZIP compressed tar archive" .tgz ReadmeName README.html HeaderName HEADER.html IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t # DefaultLanguage nl DefaultLanguage ja AddLanguage ca .ca AddLanguage cs .cz .cs AddLanguage da .dk AddLanguage de .de AddLanguage el .el AddLanguage en .en AddLanguage eo .eo AddLanguage es .es AddLanguage et .et AddLanguage fr .fr AddLanguage he .he AddLanguage hr .hr AddLanguage it .it AddLanguage ja .ja AddLanguage ko .ko AddLanguage ltz .ltz AddLanguage nl .nl AddLanguage nn .nn AddLanguage no .no AddLanguage pl .po AddLanguage pt .pt AddLanguage pt-BR .pt-br AddLanguage ru .ru AddLanguage sv .sv AddLanguage zh-CN .zh-cn AddLanguage zh-TW .zh-tw #Alias /error/ "/var/www/error/"#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 LanguagePriority ja en ca cs da de el eo es et fr he hr it ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW ForceLanguagePriority Prefer Fallback #AddDefaultCharset UTF-8 AddDefaultCharset Off AddCharset ISO-8859-1 .iso8859-1 .latin1 AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen AddCharset ISO-8859-3 .iso8859-3 .latin3 AddCharset ISO-8859-4 .iso8859-4 .latin4 AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk AddCharset ISO-2022-JP .iso2022-jp .jis AddCharset ISO-2022-KR .iso2022-kr .kis AddCharset ISO-2022-CN .iso2022-cn .cis AddCharset Big5 .Big5 .big5 AddCharset WINDOWS-1251 .cp-1251 .win-1251 AddCharset CP866 .cp866 AddCharset KOI8-r .koi8-r .koi8-ru AddCharset KOI8-ru .koi8-uk .ua AddCharset ISO-10646-UCS-2 .ucs2 AddCharset ISO-10646-UCS-4 .ucs4 AddCharset UTF-8 .utf8 AddCharset GB2312 .gb2312 .gb AddCharset utf-7 .utf7 AddCharset utf-8 .utf8 AddCharset big5 .big5 .b5 AddCharset EUC-TW .euc-tw AddCharset EUC-JP .euc-jp AddCharset EUC-KR .euc-kr AddCharset shift_jis .sjis #AddType application/x-tar .tgz #AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgz AddType application/x-compress .Z AddType application/x-gzip .gz .tgz #AddHandler cgi-script .cgi #AddHandler send-as-is asis AddHandler imap-file map AddHandler type-map var AddType text/html .shtml AddOutputFilter INCLUDES .shtmlAllowOverride None Options IncludesNoExec AddOutputFilter Includes html AddHandler type-map var Order allow,deny Allow from all LanguagePriority en es de fr ForceLanguagePriority Prefer Fallback # ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var # ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var # ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var # ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var # ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var # ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var # ErrorDocument 410 /error/HTTP_GONE.html.var # ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var # ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var # ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var # ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var # ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var # ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var # ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var # ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var # ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var # ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.varExtendedStatus On SetHandler server-status # Order deny,allow # Deny from all # #Allow from .example.com # SetHandler server-info # Order deny,allow # Deny from all # #Allow from .example.com #ProxyRequests On # # ### Section 3: Virtual Hosts NameVirtualHost *:80# Order deny,allow # Deny from all # Allow from .example.com # #ProxyVia On ## CacheEnable disk / # CacheRoot "/var/cache/mod_proxy" # #order deny,allow deny from all DocumentRoot /var/www/html CustomLog logs/access_log combined env=!no_log ErrorLog logs/error_log
Webサーバー(Apache)サーバの設定再読込
# /etc/init.d/httpd reload
![]() (0) (0) (0) (0)Total: 0 |





