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 3 years have passed since last update.

[ Laravel & Xampp ] ローカル開発環境に便利なバーチャルドメイン設定

Last updated at Posted at 2020-11-04

http://localhost/プロジェクト名/public を好みのドメインに変更する

Laravel&xamppのローカル開発で、普通にxampphtdocsフォルダ内にLaravelをインストールすると、http://localhost/プロジェクト名/publicのアドレスになると思います。

もちろん、上記のアドレスで開発もできるのですが、シンプルにhttp://プロジェクト名.localhostという感じで、フォルダ名の「public」が付かないスマートなドメインを指定してみましょう。

手順1

C:\xampp\apache\conf\extra\httpd-vhosts.confファイルを開き「NameVirtualHost *:80」の行を有効にする(行始めの#を取る)

手順2

設定1の httpd-vhosts.conf ファイルに以下を追加

<VirtualHost プロジェクト名.localhost:80>
DocumentRoot "C:/xampp/htdocs/プロジェクト名/public"
ServerName プロジェクト名.localhost
</VirtualHost>

プロジェクト名の部分を環境に応じて書き換えてください。

手順3

C:\WINDOWS\system32\drivers\etc\hostファイルを開き

127.0.0.1 プロジェクト名.localhost

を追加する。

設定が完了したら、http://プロジェクト名.localhost/ にアクセスすると、Laravelのトップページが表示されると思います。

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?