<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://shiyoka.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://shiyoka.com/feed.php">
        <title>ClownWiki - apache</title>
        <description></description>
        <link>https://shiyoka.com/</link>
        <image rdf:resource="https://shiyoka.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg" />
       <dc:date>2026-05-08T13:21:46+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:apache_login&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:configure&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:dictionary&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:htaccess&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:install&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:log_tips&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:mod_rpaf&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:mpm&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:prefork&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:proxy&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:sample001&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:sample002&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:tips&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=apache:virtualhosts&amp;rev=1739713982&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://shiyoka.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg">
        <title>ClownWiki</title>
        <link>https://shiyoka.com/</link>
        <url>https://shiyoka.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:apache_login&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>apache_login</title>
        <link>https://shiyoka.com/doku.php?id=apache:apache_login&amp;rev=1739713982&amp;do=diff</link>
        <description>apacheユーザにログインする

apacheユーザはデフォルトではログインできないユーザとなっている。


# less /etc/passwd | grep apache
apache:x:48:48:Apache:/var/www:/sbin/nologin


適当な既存のユーザからユーザディレクトリをコピー、権限設定する。</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:configure&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>configure</title>
        <link>https://shiyoka.com/doku.php?id=apache:configure&amp;rev=1739713982&amp;do=diff</link>
        <description>apache設定ファイル

Sample Code


#
# WordPress
#
&lt;Directory &quot;/var/www/vhosts/wordpress/&quot;&gt;
  SSLRequireSSL
  Options None
  AllowOverride All
  Order Deny,Allow
#  Allow from all
#  Allow from 127.0.0.1
#  Allow from 123.123.123.123 124.124.124.124
  AuthName &quot;WordPress Access&quot;
  AuthType Basic
  AuthUserFile /var/www/vhosts/wordpress/htpasswd.users
  Require valid-user
&lt;/Directory&gt;

Alias /wordpress/var/www/vhosts/wordpress</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:dictionary&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>dictionary</title>
        <link>https://shiyoka.com/doku.php?id=apache:dictionary&amp;rev=1739713982&amp;do=diff</link>
        <description>用語

&lt;http://e-words.jp/&gt;
&lt;http://ja.wikipedia.org/wiki/&gt;
などから引用

Apache

Apache HTTP Server
&lt;http://ja.wikipedia.org/wiki/Apache_HTTP_Server&gt;

	&quot; 最も人気の高いWebサーバソフトウェアの一つ。&quot;

Tomcat

Apache Tomcat
&lt;http://ja.wikipedia.org/wiki/Apache_Tomcat&gt;

	&quot; Jakartaプロジェクトのサブプロジェクトとして開発されているオープンソースのソフトウェアで、Javaサーブレット・JSPを処理するアプリケーションサーバ。Tomcatは単独でWebサーバとして動作することも可能だが、ApacheやIISのプラグインと動作できるようになっており、実際にはプラグインとしての利用が主流である。…</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:htaccess&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>htaccess</title>
        <link>https://shiyoka.com/doku.php?id=apache:htaccess&amp;rev=1739713982&amp;do=diff</link>
        <description>.htaccess

sample

Code


RewriteEngine on
RewriteRule ^3b http://ensoku.dyndns.org [R=301,L]
RewriteRule ^3b/(.*)$ http://ensoku.dyndns.org/$1 [R=301,L]

## Add Expires headers
ExpiresActive On
ExpiresDefault &quot;access plus 1 week&quot;

## Compress components with gzip
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header ap…</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:install&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>install</title>
        <link>https://shiyoka.com/doku.php?id=apache:install&amp;rev=1739713982&amp;do=diff</link>
        <description>Apache Install

	*  インストール


# yum -y install httpd


	*  conf ファイル編集（=設定）


# vi /etc/httpd/conf/httpd.conf


設定サンプル

	*  起動


# /etc/rc.d/init.d/httpd start
（# service httpd start）


	*  自動起動設定


# chkconfig httpd on</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:log_tips&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>log_tips</title>
        <link>https://shiyoka.com/doku.php?id=apache:log_tips&amp;rev=1739713982&amp;do=diff</link>
        <description>Apache のログに関するTIPS

不要なアクセスログを残さない

画像ファイルにアクセスしたログなど、不要なアクセスログを残さないように設定する。


# SetEnvIf
# URIの一部の文字列で判定
SetEnvIf Request_URI &quot;\.(gif|jpg|png|css|js)$&quot; nolog

# 接続元のIPアドレスで判定
SetEnvIf Remote_Addr 127.0.0.1 nolog

# ユーザエージェントで判定
SetEnvIf User-Agent &quot;bot&quot; nolog

～

CustomLog logs/access_log combined env=!nolog</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:mod_rpaf&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>mod_rpaf</title>
        <link>https://shiyoka.com/doku.php?id=apache:mod_rpaf&amp;rev=1739713982&amp;do=diff</link>
        <description>mod_rpaf

リバースプロキシ、ロードバランサなどを経由したWEBサーバへのアクセスでは、通常、アクセス元のIPアドレスがリバースプロキシ、ロードバランサなどになる。
そこで、リバースプロキシ、ロードバランサなどのX-Forwarded-Forから本来のアクセス元IPアドレスを取得できるようにする。</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:mpm&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>mpm</title>
        <link>https://shiyoka.com/doku.php?id=apache:mpm&amp;rev=1739713982&amp;do=diff</link>
        <description>MPM

マルチプロセッシングモジュール (MPM)

Apache HTTP サーバではリクエストを処理する部分のことを指す。
多種多様なプラットフォームに効率的に設計されたモジュール。
Apache HTTP サーバ 2.0系から採用されている。</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:prefork&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>prefork</title>
        <link>https://shiyoka.com/doku.php?id=apache:prefork&amp;rev=1739713982&amp;do=diff</link>
        <description>preforkのチューニング

サンプル

標準の値


&lt;IfModule prefork.c&gt;
 StartServers       8
 MinSpareServers    5
 MaxSpareServers   20
 ServerLimit      256
 MaxClients       256
 MaxRequestsPerChild  4000
&lt;/IfModule&gt;


チューニングサンプル（その1）</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:proxy&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>proxy</title>
        <link>https://shiyoka.com/doku.php?id=apache:proxy&amp;rev=1739713982&amp;do=diff</link>
        <description>Reverse Proxy

プロキシサーバの ～/redmine にアクセスしたら、SERVERサーバの ～/redmine に転送する


LoadModule proxy_http_module modules/mod_proxy_http.so

ProxyPass /redmine http://SERVER/redmine
ProxyPassReverse /proxy http://SERVER/redmine
ProxyRequests Off</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:sample001&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sample001</title>
        <link>https://shiyoka.com/doku.php?id=apache:sample001&amp;rev=1739713982&amp;do=diff</link>
        <description>ログを別サーバへローテートのシェル

※expect のインストール要


# yum -y install expect



#!/bin/sh

# パラメータ
APACHE_DIR=&quot;/var/log/httpd/&quot;
ACCESSLOG=&quot;access_log&quot;
ERRORLOG=&quot;error_log&quot;
DIST=`hostname`

#HOST=&quot;192.168.80.222&quot;
HOST=&quot;ManageServer&quot;
USER=&quot;user&quot;
PASS=&quot;password&quot;
TARGET_DIR=&quot;/var/log_backup&quot;
yes=&quot;yes&quot;


###############################################################################
# アクセスログ、エラーログを圧縮
# apache の再起動は安全の為に graceful で行いたいが、
# cronですると再起動に失敗する
#

# バックアップ日付(現在時刻)の取得
BKDATE=`date +%Y%m%d_%H%M%S`

# 各ログファ…</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:sample002&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sample002</title>
        <link>https://shiyoka.com/doku.php?id=apache:sample002&amp;rev=1739713982&amp;do=diff</link>
        <description>ログを別サーバへローテートのシェル_2

・3種類のファイルをWEBサーバからバッチ実行サーバへコピーして、そこからログ保管サーバへコピー。
・WEBサーバ＜－＞バッチサーバ、バッチサーバ＜－＞ログサーバは鍵認証でパスワード不要
・WEBサーバ＜－＞ログサーバは直接アクセス不可
・実行時に日付オプションを渡せばその日付のファイルが処理される。渡さなければ昨日の日付。…</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:tips&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>tips</title>
        <link>https://shiyoka.com/doku.php?id=apache:tips&amp;rev=1739713982&amp;do=diff</link>
        <description>Tips

サービス起動時などのエラーあれこれ

httpd: apr_sockaddr_info_get()

サービスを起動しようとすると、以下のエラーメッセージが表示される。


# /etc/init.d/httpd start
httpd を起動中: httpd: apr_sockaddr_info_get() failed for server.name.com
httpd: Could not reliably determine the server&#039;s fully qualified domain name, using 127.0.0.1 for ServerName</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=apache:virtualhosts&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>virtualhosts</title>
        <link>https://shiyoka.com/doku.php?id=apache:virtualhosts&amp;rev=1739713982&amp;do=diff</link>
        <description>virtualhosts

httpd.conf


# vi /etc/httpd/conf/httpd.conf



-) #NameVirtualHost *:80
+) NameVirtualHost *:80


vhosts.conf


# vi /etc/httpd/conf.d/vhosts.conf


以下の記述を適宜修正しながら必要なだけ並べる


&lt;VirtualHost *:80&gt;	
   ServerAdmin webmaster@dummy-host.example.com	
   DocumentRoot &quot;/var/www/vhosts/html/public_html&quot;	
   ServerName testsv.example.com  	
   DirectoryIndex index.php index.html	
   ErrorLog /var/www/vhosts/html/logs/error_log	
   &lt;Directory &quot;/var/www/vhosts/html/public_html&quot;&gt;	
      AllowOve…</description>
    </item>
</rdf:RDF>
