0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

複数XAMPPでディレクトリ共用の覚え書き

Posted at

PHP7.1 / 5.6 / 5.2用のXAMPPから同じドキュメントルートを使うように設定をした際の覚え書きです。

  • 目的

    • ローカルのwikiをどのXAMPP起動中でも使用。
    • 同じプログラムを複数バージョンで確認。
  • 今回の目的のディレクトリ

    • C:\dev\vhosts\dev\htdocs
    • C:\dev\vhosts\pukiwiki
  • 設定ファイルの場所
    (略)\XAMPPのディレクトリ\apache\conf\extra\httpd-vhosts.conf

    • NameVirtualHost *:80を有効化すると、元のhtdocsにアクセスできなくなるので、そこをドキュメントルートにしたVirtualHostのディレクティブもvhostsに追加します。

XAMPP 7 / 5.6系(PHP 7 / 5.6 用 Apache 2.4)

  • XAMPP 5.6.36 および XAMPP 7.1.11
  • Apache 2.4なので、Require all grantedを使用します。
  • 今回の場合、ポータブル版をC:\dev\xampppt5_6_36といった感じで置いています。
NameVirtualHost *:80
### XAMPP自身のhtdocsを使えるようにしておく
<VirtualHost *:80>
    DocumentRoot "C:/dev/xampppt5_6_36/htdocs"
    ServerName localhost:80
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    <Directory "C:/dev/xampppt5_6_36/htdocs">
        Options Indexes
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
### 別バージョンのXAMPPから呼び出すディレクトリ
<VirtualHost *:80>
    DocumentRoot "C:/dev/vhosts/dev/public_html"
    ServerName dev.localhost
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    <Directory "C:/dev/vhosts/dev/public_html">
        Options Indexes
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
### 別バージョンのXAMPPから呼び出すディレクトリその2
<VirtualHost *:80>
    DocumentRoot "C:/dev/vhosts/pukiwiki"
    ServerName wiki.localhost
    ServerAlias pukiwiki.localhost
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    <Directory "C:/dev/vhosts/pukiwiki">
        Options Indexes
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

XAMPP 1.6.4( PHP 5.2.4 用 Apache 2.2)

  • Apacheが2.2系なので、Order Allow,Denyでアクセスを許可します。
  • 今回の場合、xamppliteをC:\dev\xampplite5_2_4に置いています。
NameVirtualHost *:80
### XAMPP自身のhtdocsを使えるようにしておく
<VirtualHost *:80>
    DocumentRoot "C:/dev/xampplite5_2_4/htdocs"
    ServerName localhost:80
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    <Directory "C:/dev/xampplite5_2_4/htdocs">
        Order Allow,Deny
        Allow from localhost
        Options Indexes
        AllowOverride All
    </Directory>
</VirtualHost>
### 別バージョンのXAMPPから呼び出すディレクトリ
<VirtualHost *:80>
    DocumentRoot "C:/dev/vhosts/dev/public_html"
    ServerName dev.localhost
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    <Directory "C:/dev/vhosts/dev/public_html">
        Order Allow,Deny
        Allow from localhost
        Options Indexes
        AllowOverride All
    </Directory>
</VirtualHost>
### 別バージョンのXAMPPから呼び出すディレクトリその2
<VirtualHost *:80>
    DocumentRoot "C:/dev/vhosts/pukiwiki"
    ServerName wiki.localhost
    ServerAlias pukiwiki.localhost
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    <Directory "C:/dev/vhosts/pukiwiki">
        Order Allow,Deny
        Allow from localhost
        Options Indexes
        AllowOverride All
    </Directory>
</VirtualHost>

関連記事・リンク


0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?