「Aws/lightsail」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→apache再起動) |
(→apacheバーチャルホスト設定) |
||
| (同じ利用者による、間の6版が非表示) | |||
| 行22: | 行22: | ||
==apache設定== | ==apache設定== | ||
vi /opt/bitnami/apache2/conf/httpd.conf | vi /opt/bitnami/apache2/conf/httpd.conf | ||
| + | |||
| + | ==ドキュメントルート== | ||
| + | /opt/bitnami/apache/htdocs | ||
==apache再起動== | ==apache再起動== | ||
| 行31: | 行34: | ||
Networkingタブのipの記載の下に、AttachStaticIPのリンクが、あるので、クリックしStaticIPを作成する | 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 | ||
| + | <pre> | ||
| + | <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> | ||
| + | </pre> | ||
2023年1月20日 (金) 23:57時点における最新版
ログイン方法
- https://lightsail.aws.amazon.com/ls/webapp/home
- Download default key"をクリックして、鍵をDLする。
- LightsailDefaultKey-ap-northeast-1.pemファイルがDLされる。
- 以下のような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>
