〔架站〕AWS EC2 虛擬主機設定
首先用CLI 去連線
aws 上 Apache的環境為LAMP
官方教程:
http://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/install-LAMP.html
輸入指令
輸入指令
ssh -i ~/.ssh/MyKeyPair.pem ec2-user@35.166.xx.xx
會連線到aws ubutu 虛擬機上
因為太久沒有作更新了 所以執行 sudo yum update
跑完更新後 找到路徑
/etc/httpd/conf
編輯httpd.conf檔 因為httpd.conf檔為唯讀檔 所以輸入指令的時候記得要家sudo
[ec2-user@ip-xxx-xxx-xx-172 conf]$ sudo vi httpd.conf
[ec2-user@ip-xxx-xxx-xx-172 conf]$ sudo vi httpd.conf
找到 # Use name-based virtual hosting.這一行
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
在aws的路徑下要設為
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName www.tzeng17.com
ServerAlias www.tzeng17.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/game/GivemeFind/
ServerName givemefind.tzeng17.com
ServerAlias givemefind.tzeng17.com
</VirtualHost>
設定完後記得要重啟Apache的服務
$ sudo service httpd restart
系統會跑
[ec2-user@ip-xxx-xx-xx-172 conf]$ sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[ec2-user@ip-xxx-xx-xx-172 conf]$
再連上自己設定的子網域上確認看看有沒有成功囉~
0 留言:
張貼留言