LoginSignup
19
20

More than 5 years have passed since last update.

Apache 2.2 / 2.4 バーチャルホスト設定ファイル テンプレート

Last updated at Posted at 2013-07-14

メモ

2.2

vhost.conf
<VirtualHost _default_:80>
        DocumentRoot /var/www/vhost/localhost/html
        ServerName localhost

        ErrorLog logs/localhost-error_log
        CustomLog logs/localhost-access_log common
        <Directory  /var/www/vhost >
                # default charset UTF-8
                AddDefaultCharset utf-8

                # .htaccess setting
                AllowOverride All

                # SSI OK
                # SymbolicLink OK
                Options Includes FollowSymLinks

                Order Deny,Allow
                Allow from all
        </Directory>

        <Files ~ "^\.">
                # .ht*
                # .svn*
                # .csv*
                #  etc
                Deny from all
        </Files>

        <Files ~ ".*conf.*">
                # config.inc.php
                # ****.conf
                Deny from all
        </Files>

        <Files ~ "(\.tmpl|\.tpl|\.vm|\.mayaa|\.properties|\.back|\.bk|~|[0-9]+|build.xml)$">
                # .tmpl  .tpl .vm     : Template Files
                # .mayaa .properties  : Control File
                # .back .bk *~ *n     : Backup File
                # build.xml           : Ant Build Control File
                Deny from all
        </Files>
</VirtualHost>

2.4

vhost.conf
<VirtualHost _default_:80>
        DocumentRoot /var/www/vhost/localhost/html
        ServerName localhost

        ErrorLog logs/localhost-error_log
        CustomLog logs/localhost-access_log common
        <Directory  /var/www/vhost >
                # default charset UTF-8
                AddDefaultCharset utf-8

                # .htaccess setting
                AllowOverride All

                # SSI OK
                # SymbolicLink OK
                Options +Includes +FollowSymLinks

                # aapche 2.4 change config
                # Order Deny,Allow
                # Allow from all
                Require all granted

        </Directory>

        <Files ~ "^\.">
                # .ht*
                # .svn*
                # .csv*
                #  etc
                # Deny from all
               # apache 2.4 changed
                Require all denied
        </Files>

        <Files ~ ".*conf.*">
                # config.inc.php
                # ****.conf
                # Deny from all
               # apache 2.4 changed
                Require all denied
        </Files>

        <Files ~ "(\.tmpl|\.tpl|\.vm|\.mayaa|\.properties|\.back|\.bk|~|[0-9]+|build.xml)$">
                # .tmpl  .tpl .vm     : Template Files
                # .mayaa .properties  : Control File
                # .back .bk *~ *n     : Backup File
                # build.xml           : Ant Build Control File
                # Deny from all
               # apache 2.4 changed
                Require all denied
        </Files>
</VirtualHost>

19
20
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
20