HOME       LIST

【Apache】Windows Apache WEB Server 設定(Apache 2.4.20)

Apache Web Serverの設定をメモ。 http.conf, httpd-mpm-conf, virtual host, hosts


1. 環境

PC OS : Windows7, Windows10
Apache Version : Apache 2.4.20

2. httpd.conf編集

([Apacheインストールフォルダ]/conf/httpd.conf)

# Apache24の経路編集
ServerRoot "c:/Apache24"

# Apache24の経路編集(このhtddocsがデフォールト文書directory)
DocumentRoot "c:/Apache24/htdocs"

#Apache24の経路編集
<Directory "c:/Apache24/htdocs">

#Apache24の経路編集
ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"

<Directory "c:/Apache24/cgi-bin">
Listen 80
#ServerName www.example.com:80
localhost:80

Include conf/extra/httpd-mpm.conf

#Virtual Host 設定の為
Include conf/extra/httpd-vhosts.conf

3. httpd-mpm.conf編集

(/conf/extra/httpd-mpm.conf)
<IfModule mpm_winnt_module>
    ThreadsPerChild        150
    MaxConnectionsPerChild   0
    AcceptFilter http none
    AcceptFilter https none
    EnableSendfile off
    EnableMMAP off
</IfModule>

4. Virtual Host 設定

(/conf/extra/httpd-vhost.conf)
<VirtualHost *_80>
    # PCの文書位置
    DocumentRoot "c:/web/com"

    # ブラウザからのホスト名
    ServerName localhost

    ErrorLog "c:/web/files/logs/com/error.log"
    CustomLog "c:/web/files/logs/com/access.log" common
     <Directory "c:/web/com">
          #Require all granted
          
          # localhostのみ接続を許可(他のパソコンからの接続を拒否する場合)
          Require all denied
          Require ip 127.0.0.1
     </Directory>
</VirtualHost>

5. Apacheの起動

コマンドプロンプトから「~\Apache24\bin」の「httpd」を実行する。

6. Apacheをサービスとして登録、起動、停止、サービスから削除

6-1. サービス登録

  httpd -k install

6-2 サービスに登録したApacheを起動する。

  httpd -k start

6-3. Apacheを停止する

  httpd -k stop

6-4. Apacheを再起動する

  httpd -k restart

6-5. サービスから削除

  httpd -k uninstall

以前コンテンツ:サイバー攻撃の種類、対策
次のコンテンツ:【TOMCAT】Log4Jのログファイル位置



Copyright(c) 2007-2024 dojeun.com All Rights Reserved.

Valid XHTML 1.0 Transitional