facebook twitter hatena line email

Aws/lightsail

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

ログイン方法

  1. https://lightsail.aws.amazon.com/ls/webapp/home
  2. Download default key"をクリックして、鍵をDLする。
  3. LightsailDefaultKey-ap-northeast-1.pemファイルがDLされる。
  4. 以下のようなshellを作る
ssh -i LightsailDefaultKey-ap-northeast-1.pem bitnami@54.250.xx.xx

https化対応

公式:https://lightsail.aws.amazon.com/ls/docs/ja_jp/articles/amazon-lightsail-enabling-https-on-wordpress

お名前などから、ドメインを割り当てた後、以下実行。

$ sudo /opt/bitnami/bncert-tool
Domain list []: aws.nonip.net
The following domains were not included: www.aws.nonip.net. Do you want to add them? [Y/n]: n
Enable HTTP to HTTPS redirection [Y/n]: y
Do you agree to these changes? [Y/n]: y
E-mail address []: ******@gmail.com
Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]: y

https化できた。

apache設定

vi /opt/bitnami/apache2/conf/httpd.conf

ドキュメントルート

/opt/bitnami/apache/htdocs

apache再起動

bitnamiを使っておりそれに従う。

sudo /opt/bitnami/ctlscript.sh restart apache

固定IP化

固定IP化対応をしないと、インスタンスを停止するたびに、ipが変わる。

Networkingタブのipの記載の下に、AttachStaticIPのリンクが、あるので、クリックしStaticIPを作成する

apacheバーチャルホスト設定

ドキュメントルート(例:test.example.com)

mkdir -p /home/bitnami/test.example.com/public

バーチャルホスト設定(例:test.example.com)

vi /opt/bitnami/apache2/conf/vhosts/test.example.com.conf
<VirtualHost test.example.com:80 _default_:80>
   ServerName test.example.com
   ServerAlias *
   DocumentRoot /home/bitnami/test.example.com/public
   <Directory "/home/bitnami/test.example.com/public">
     Options -Indexes +FollowSymLinks -MultiViews
     AllowOverride All
     Require all granted
   </Directory>
 </VirtualHost>
 
 <VirtualHost test.example.com:443 _default_:443>
   DocumentRoot /home/bitnami/test.example.com/public
   SSLEngine on
   SSLCertificateFile "/opt/bitnami/apache/conf/example.com.crt"
   SSLCertificateKeyFile "/opt/bitnami/apache/conf/example.com.key"
 
   # BEGIN: Configuration for letsencrypt
   Include "/opt/bitnami/apps/letsencrypt/conf/httpd-prefix.conf"
   # END: Configuration for letsencrypt
   # BEGIN: Support domain renewal when using mod_proxy without Location
   <IfModule mod_proxy.c>
     ProxyPass /.well-known !
   </IfModule>
   # END: Support domain renewal when using mod_proxy without Location
   <Directory "/home/bitnami/test.example.com/public">
     Options Indexes FollowSymLinks
     AllowOverride All
     Require all granted
   </Directory>
 
 </VirtualHost>