Windowsの開発環境
1. git for windows
1-1. ここからインストール
1-2. 環境変数に設定
1-3. メールアドレス、ユーザ名を設定
git config --global user.name "ユーザー名" git config --global user.email "メールアドレス" git config --global core.quotepath false #日本語ファイル名がエスケープされないように
登録されてるか確認
$ git config --list user.name=[先ほど設定したユーザ名] user.email=[先ほど設定したメールアドレス]
2. Visual Studio Code
2-1. ここからインストール
Visual Studio Code – コード エディター | Microsoft Azure
2-2. terminalに設定する
ファイル→ユーザー設定→設定
setting.jsonを以下のように記載
{ "workbench.colorTheme": "Visual Studio Light", "editor.fontWeight": 800, "[json]": { "editor.quickSuggestions": { "strings": true }, "editor.suggest.insertMode": "replace" }, "php.validate.executablePath": "C:\\xampp\\php\\php.exe", "terminal.external.windowsExec": "C:\\Program Files\\Git\\git-bash.exe", "terminal.integrated.defaultProfile.windows": "Git Bash", "window.zoomLevel": 1 }
3. 鍵作成
ディレクトリ作成
mkdir .ssh
権限変更
chmod 700 .ssh/
作成したディレクトリに移動
cd .ssh
鍵を作成します。下記がでたらEnterキーを押す
$ ssh-keygen -t rsa -b 4096 -C "<自分のGitHubメールアドレス>" > Generating public/private rsa key pair.
パスフレーズを入力
> Enter a file in which to save the key (/home/<user>/.ssh/id_rsa): [Press enter]
もう一度入力
> Enter passphrase (empty for no passphrase): > Enter same passphrase again:
下記のような表示がでたら作成完了
Your identification has been saved in /home/username/.ssh/id_rsa. Your public key has been saved in /home/username/.ssh/id_rsa.pub. The key fingerprint is:SHA256:sawrngnbieBhebKbfueKUBEbuget, The key's randomart image is: +---[RSA 4096]----+ | -A_O. . | | ..A. = | | oB=O* | | o. = o | | *...A - || = - A C || DD o o | | P-A . | | .A... | +----[SHA256]-----+
~/.sshディレクトリ配下に公開鍵id_rsa.pubと秘密鍵id_rsaのファイルが作成されていることが確認する
$ ls -al ~/.ssh id_rsa id_rsa.pub
ssh-agentを開始
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa
4.github
4-1. githubに鍵を登録
5. 接続設定
5-1. configファイル作成
ファイル生成
touch ~/.ssh/config
中身に以下を貼り付け
Host github HostName github.com IdentityFile ~/.ssh/id_rsa User git
6. 接続確認
$ ssh -T git@github.com Hi TechsReport! You've successfully authenticated, but GitHub does not provide shell access.
7. XAMPP
7-1. インストール
7-2. 作業ディレクトリとテストファイルを作成
下記のようにhtmlファイルを作成する
C:\Users\<username>\Desktop\work\test001\index.html
<!DOCTYPE html> Hello </html>
7-3. バーチャルホストを有効にする
下記を開く
(念のためバックアップを取っておくこと)
C:\xampp\apache\conf\httpd.conf
521行目あたりに「httpd-vhosts.conf」とあるので、先頭の「#」を外す
これで有効化となる
# Virtual hosts #Include conf/extra/httpd-vhosts.conf
# Virtual hosts Include conf/extra/httpd-vhosts.conf
7-4. ドキュメントルートの設定
下記を開く
(念のためバックアップをとっておく)
C:\xampp\apache\conf\extra\httpd-vhosts.conf
20行目あたりの「##」を外す
##NameVirtualHost *:80
バーチャルホスト以外を拒否する場合は下記を追記する
<VirtualHost _default_:80> ServerName any <Location /> Require all denied </Location> </VirtualHost>
下記を参考に作業ディレクトリを追加して上書きする
<VirtualHost *:80> DocumentRoot "C:\Users\<username>\Desktop\work\test001" ServerName myhost </VirtualHost> <Directory "C:\Users\<username>\Desktop\work\test001"> AllowOverride All Require all granted </Directory>
7-5. サーバーネームの設定
下記のファイルを開く
(念のためバックアップを取っておく)
C:\Windows\System32\drivers\etc\hosts
一番に下記を追加する
(「myhost」はhttpd-vhostsの「ServerName」で記載したものを指定する)
127.0.0.1 myhost
7-5. XAMPPを再起動する
設定ファイル編集後は、必ずXAMPPを再起動させる必要がある
7-6. webサイトを確認
XAMPPで「start」を押し起動後ブラウザで以下を開く
(「myhost」はhostsで記載したものを指定)
http://myhost