【Xcode】プロジェクト環境に合わせたInstallコマンド
覚書
#まずはbundle bundle install --path vendor/bundle #そしてプロジェクトのbundleを使う bundle exec pod install
覚書
#まずはbundle bundle install --path vendor/bundle #そしてプロジェクトのbundleを使う bundle exec pod install
古い環境が必要となり旧macへXcodeやRuby環境つくる時にハマったので覚書
20220315
■環境
macOS High Sierra 10.13.6
Homebrew 3.4.1-67-gb31d8e9
rbenv 1.2.0
こんなエラーが発生
Downloading openssl-1.1.1l.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1 Installing openssl-1.1.1l... BUILD FAILED (Mac OS X 10.13.6 using ruby-build 20220218) Inspect or clean up the working tree at /var/folders/rc/9hwgt2nd0rxgjzvt9kc0zgph0000gn/T/ruby-build.20220315231102.889.ggie1q Results logged to /var/folders/rc/9hwgt2nd0rxgjzvt9kc0zgph0000gn/T/ruby-build.20220315231102.889.log Last 10 log lines: /usr/include/CommonCrypto/CommonRandom.h:35:9: error: unknown type name 'CCCryptorStatus' typedef CCCryptorStatus CCRNGStatus; ^ crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess' if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess) ^ 2 errors generated. make[1]: *** [crypto/rand/rand_unix.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [all] Error 2
そこでOpenSSL1.0が必要
以下のコマンドにて「rbenv/tap/openssl@1.0 1.0.2t」がインストールされる
#OpenSSL1.0をInstall brew install rbenv/tap/openssl@1.0 #環境変数設定 [hogeはuserだよ] echo 'export PATH="/usr/local/opt/openssl@1.0/bin:$PATH"' >> /Users/hoge/.bash_profile #環境変数反映 source .bash_profile #必要なら環境変数反映 export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib" export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include" export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig" #これその後のコマンド用に必要! export RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl@1.0`" #好きなRubyインストール rbenv install 2.6.9
macOSの場合はOpenSSLの影響が他にもある
OpenSSLはRailsなどに使用するmysql2ライブラリーにも影響あり、MySQL5.6 Or 5.7使用する際にも影響あるので注意!
bundle installする前に
[.bundle/config]ファイルへ
以下、設定が必要!
BUNDLE_BUILD__MYSQL2: "--with-ldflags=-L/usr/local/opt/openssl@1.0/lib --with-cppflags=-I/usr/local/opt/openssl@1.0/include"
ElasticIPの追加でエラーが出ました。
初期設定としてElasticIPは上限が5個となっています。
増やすには申請が必要です。
30分ぐらいで返信がきます。
申請先リンク:ElasticIP申請先
注意!AWSへログインしてからリンク先押下
■新サービスによりIPが必要
制限緩和のリクエスト 1
サービス: Elastic IPs
リージョン: アジアパシフィック(東京)
制限の名前: EC2-Classic Elastic IP アドレス上限
申請する上限数: 10
------------
申請理由の説明: IP address is required to build a new service
AWS
ELB
EC2
Apache2.4.39
ロードバランサーを使用している場合、ApacheなどのWebサーバーログにはELBのIPのみ出力されてしまい、本来のクライアントIPが出力されない
AWS ELBの場合「X-Forwarded-For」にヘッダーに入っているのでこれをログ出力するようにWebサーバーに設定する必要がある
Apache conf 追加サンプル
LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common
AWS
ELB(ロードバランサー)
SSL
Apache 2.4.39
Wordpress 5.1
■通信環境
クライアントPC
↓
(port:443)
↓
ELB[SSL証明書設定][ELBルールで外部からの80アクセスは443へリダイレクト]
↓
(port:80)
↓
EC2(EC2内は80設定のみでOK)
■事象
・ブラウザからメインhttps(443)へアクセス
・EC2内は80環境として設定しているのでWordpressはhtml生成時にcssなどheader内URLをhttp(80)とする
・ブラウザがheader内URLにメインURLと違うhttp(80)が存在するとセキュリティエラーとして読み込みストップ
・ブラウザ上に正しくhtmlが表示されない
■.htaccessのrewriteのみパターン
# BEGIN K.Miyakoshi
# AWS ELBからのアクセスをHTTPSへ変更する
SetEnvIf X-Forwarded-Proto ^https$ HTTPS=on
# httpアクセスをhttpsへリダイレクトする
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} ^http$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# END K.Miyakoshi
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
■「conf.d」などvhost.confなどでガッツリパターン
#============================================ # ELB 共通ログ対応 K.Miyakoshi #============================================ # AWS ELB 対応 クライアントIP取得のため[%{X-Forwarded-For}i]追加 LogFormat "%{X-Forwarded-For}i:%{X-Forwarded-Port}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" elb-accesslog ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %{X-Forwarded-For}i:%{X-Forwarded-Port}i %a] %M% ,\ referer\ %{Referer}i" # AWS ELB 対応 ヘルスチェックアクセスを通常ログから除外 SetEnvIf User-Agent "ELB-HealthChecker.*" nolog # AWS ELB 対応 ヘルスチェックアクセスを別ログファイルに出力する設定 SetEnvIf User-Agent "ELB-HealthChecker.*" elb-log # imgやjsなどログから除外 SetEnvIf Request_URI "\.(gif|jpg|png|ico|jpeg|js|css)$" nolog # 通常のログ設定 CustomLog logs/access_log elb-accesslog env=!nolog ErrorLog logs/error_log #============================================ # ELB WordPress 対策 https(443)→http(80)リダイレクト問題 #============================================ # AWS ELBがhttpsで受けている場合はHTTPSを有効にする SetEnvIf X-Forwarded-Proto ^https$ HTTPS=on # httpアクセスはhttpsにリダイレクトする <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} ^http$ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] </IfModule> #============================================ # default # ELBのヘルスチェックに使用(Aliasでも良い) #============================================ <VirtualHost _default_:80> ServerName _default_:80 ServerAdmin admin@hoge.com DocumentRoot "/opt/lampp/htdocs" <Directory "/opt/lampp/htdocs"> AllowOverride All Options FollowSymLinks Require all granted Options +IncludesNoExec AddOutputFilter INCLUDES html </Directory> CustomLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/htdocs/access_%Y%m%d.log 86400 540" elb-accesslog env=!nolog CustomLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/htdocs/elb_%Y%m%d.log 86400 540" elb-accesslog env=elb-log ErrorLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/htdocs/error_%Y%m%d.log 86400 540" </VirtualHost> #============================================ # taro.hoge.com #============================================ <VirtualHost *:80> ServerName taro.hoge.com ServerAdmin admin@hoge.com DocumentRoot "/opt/lampp/taro" <Directory "/opt/lampp/taro"> AllowOverride All Options FollowSymLinks Require all granted </Directory> CustomLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/taro/access_%Y%m%d.log 86400 540" elb-accesslog env=!nolog # AWS ELB に[taro.hoge.com]DNSに紐づいて設定せれていればログ出力される CustomLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/taro/elb_%Y%m%d.log 86400 540" elb-accesslog env=elb-log ErrorLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/taro/error_%Y%m%d.log 86400 540" </VirtualHost> #============================================ # jiro.hoge.com #============================================ <VirtualHost *:80> ServerName jiro.hoge.com ServerAdmin admin@hoge.com DocumentRoot "/opt/lampp/jiro" <Directory "/opt/lampp/jiro"> AllowOverride All Options FollowSymLinks Require all granted </Directory> CustomLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/jiro/access_%Y%m%d.log 86400 540" elb-accesslog env=!nolog # AWS ELB に[jiro.hoge.com]DNSに紐づいて設定せれていればログ出力される CustomLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/jiro/elb_%Y%m%d.log 86400 540" elb-accesslog env=elb-log ErrorLog "| /opt/lampp/bin/rotatelogs /opt/lampp/logs/jiro/error_%Y%m%d.log 86400 540" </VirtualHost> #============================================