localhosthttp://localhost/greenmugcafe/
の仮想ホスト ディレクトリをC:/Users/Robert/Documents/GitHub/
個人的には、localhost ドメインに greenmugcafe というフォルダーを配置するよりも、greenmugcafe.dev というローカル ドメインを作成した方がよいと思います。
WAMP で仮想ホストをセットアップする方法
仮想ホストが有効になっていることを確認します。
- 編集
/installdir/apache2/conf/httpd.conf
- を含む行を検索
httpd-vhosts.conf
し、先頭の # を削除してコメントを解除します
新しい仮想ホストの追加:
hosts
Windows システム上のファイルを編集します (通常は にありますC:\WINDOWS\system32\drivers\etc\
) 。
- hosts ファイルの末尾に以下を追加します
127.0.0.1 greenmugcafe.dev
。これにより、値が の URL はすべて(別名 localhost)greenmugcafe.dev
にルーティングする必要があることがコンピューターに伝えられます。127.0.0.1
- ファイルを保存して、
hosts
このファイルを編集します/installdir/apache2/conf/extra/httpd-vhosts.conf
- ファイルの下部に greenmugcafe.dev 仮想ホスト エントリを追加し
/installdir/apache2/conf/extra/httpd-vhosts.conf
、保存して、サーバーを再起動します。
コードは次のとおりです。
#greenmugcafe
<VirtualHost *:80>
ServerAdmin webmaster@greenmugcafe.dev
DocumentRoot "C:/Users/Robert/Documents/GitHub/greenmugcafe/"
ServerName greenmugcafe.dev
ErrorLog "logs/greenmugcafe.dev-error.log"
CustomLog "logs/greenmugcafe.dev-access.log" common
<Directory "C:/Users/Robert/Documents/GitHub/greenmugcafe/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Require all granted
</Directory>
</VirtualHost>
これでhttp://greenmugcafe.devは C:/Users/Robert/Documents/GitHub/greenmugcafe/ を指すようになります
この方法は、Wamp Server や XAMPP などの他の WAMP スタックでも機能します。
Linux サーバーで起動した Web サイトの場合、Windows ホスト ファイルの代わりにa record
、ドメイン名の をサーバーの IP アドレスを指すように変更します。次に、サーバーがドメイン名を認識し、サーバー上の正しいフォルダーを指すように、仮想ホストをセットアップする必要があります。
それが役立つことを願っています:-)