さくらVPSでSSL導入
さくらVPSを借りてやったこと
さくらVPSを借りてやったことのメモ
作業内容
- CentOS7に変更
- 作業ユーザーを作成
- 公開鍵認証設定
- rootアカウントのログインを許可しない
- パスワード認証を許可しない
- Port番号を変更
- yum update
- Laravel環境の構築
完了するとLaravelのトップページを確認できる。
課題
- ローカルで開発しているLaravelプロジェクトのデプロイ
- SSL導入
追記:対応済
参考
Google Domainsで取得したドメインをさくらのレンタルサーバーで使用する
Google Domainsで取得したドメインをさくらのレンタルサーバーで使用する時のメモ
前提
さくら側の設定
記事に沿って作業を進める。 レンタルサーバー取得直後に行うと「初期ドメインがDNSに登録されていません。しばらく後に設定して下さい」の表記になる。 (時間を置いて再度設定を行うと問題なく進めた。)
参考:【ドメイン設定】他社で取得・管理中のドメインを利用 – さくらのサポート情報
Google Domains側の設定
カスタムサーバに切り替え。
さくらインターネット指定ネームサーバ
参考:ドメイン ネームサーバーの管理 - Google Domains ヘルプ
SSL対応
SSLを導入する。記事に沿って管理画面から行う。
参考:【無料SSL】サーバコントロールパネルからの導入手順 – さくらのサポート情報
まとめ
Elastic Beanstalk + Laravelで環境構築
Elastic Beanstalk + Laravelで環境構築した時のメモ
概要
Elastic Beanstalk + Laravelの組み合わせでデプロイの標準的な方法が中々見つからず苦戦し、最終的にAWSのドキュメントに沿って進めることにしました。 しかし、このドキュメントだけでは500エラーの表示となってしまい色々と調べていたところ、こちらの記事を呼んで環境変数の設定が抜けていることが分かりました。
記事に沿って環境変数を設定し、無事にデフォルトのページを表示できました。 文章で書くと短いですが、普段使っているRailsに比べて情報の数自体が少なくてなんだかんだで半日近く使いました。
作業内容
環境構築
Elastic Beanstalkから新しい環境を作成(カスタマイズでmysqlも作成)
キーペアを作成して紐付け
AWS Elastic Beanstalk 環境のセキュリティ - AWS Elastic Beanstalk
SSL対応
- HTTPS を復号するよう Elastic Beanstalk 環境のロードバランサーを設定する - AWS Elastic Beanstalk
- AWS:無料でSSL証明書を取得する方法 - Qiita
確認
リダイレクト
httpからhttpsへのリダイレクト設定
[新機能]Webサーバでの実装不要!ALBだけでリダイレクト出来るようになりました! | DevelopersIO
ロードバランサへの対応
httpsリンクが生成されない問題があり、原因はロードバランサを使用していることにありました。リンクを参考に信用するプロキシの設定を行いました。
TLS/SSL証明を行うロードバランサの裏でアプリケーションが実行されている場合、アプリケーションが時々HTTPSリンクを生成しないことに、気づくでしょう。典型的な理由は、トラフィックがロードバランサにより80番ポートへフォワーディングされるため、セキュアなリンクを生成すべきだと判断できないからです。
protected $proxies = '*';
デプロイ
今回はこちらで対応しましたが検討の余地ありと感じています。
- Deployerを使用
- ec2でデプロイ用のユーザーを作成
- authorized_keysに開発メンバーの公開鍵を追加
- リポジトリは
git@github.com:xxx
を指定
Linux インスタンスでのユーザーアカウントの管理 - Amazon Elastic Compute Cloud PHP - PHP Deployerのデプロイ時のGitアカウントの入力を省略したい|teratail
参考リンク
CentOS7で名前解決できないエラー対応
vagrant upで以下のエラーが出た時の対応メモ。
The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! yum install -y kernel-devel kernel-devel-`uname -r` gcc binutils make perl bzip2 Stdout from the command: Loaded plugins: fastestmirror Determining fastest mirrors Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" Stderr from the command: One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=<repoid> ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable <repoid> or subscription-manager repos --disable=<repoid> 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true Cannot find a valid baseurl for repo: base/7/x86_64
$ vagrant ssh # ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. # ping google.com ping: google.com: Name or service not known # vi /etc/sysconfig/network-scripts/ifcfg-{xxx} DNS1=8.8.8.8 DNS2=8.8.4.4 # systemctl restart network # ping google.com PING google.com (172.217.25.206) 56(84) bytes of data.
参考
CentOS6 or CentOS7(VirtualBox)で名前解決ができなくなった場合の対処方法 - web-technical-blog
VagrantでRails環境を構築
- VirtualBoxをインストール
- Vagrantをインストール
$ vagrant ssh
$ sudo yum update $ sudo yum -y install git $ git clone https://github.com/rbenv/rbenv.git ~/.rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile $ source ~/.bash_profile $ mkdir -p "$(rbenv root)"/plugins $ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build $ rbenv install --list $ sudo yum install gcc make openssl-devel libffi-devel readline-devel $ rbenv install 2.3.0 $ rbenv global 2.3.0 $ ruby -v ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] $ sudo yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm $ sudo yum install mysql mysql-devel mysql-server mysql-utilities $ sudo chkconfig mysqld on $ sudo service mysqld start $ sudo yum -y install ImageMagick ImageMagick-devel $ gem install bundler -N $ sudo yum install libxml2-devel libxslt-devel $ gem install nokogiri -v '{version}' -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2/ $ curl --silent --location https://rpm.nodesource.com/setup | bash - $ yum -y install nodejs $ sudo yum -y install epel-release $ sudo yum -y install redis
参考
Oculus Goでスクリーンショット・録画を撮る方法
撮影方法
ホーム画面 > シェア > 録画を選択
確認方法
撮影した写真・映像は「ギャラリー」で確認可能
取り出し方法
調べるといくつか方法があるようですがAndroid File Transferの利用が簡単でした。 https://www.android.com/filetransfer/