Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
3
Help us understand the problem. What is going on with this article?
@takashi0314

HTTPSのリスナーをもつELBにWordpressのインスタンスをぶらさげるときのTIPS

More than 1 year has passed since last update.

AWS上でALBの下にWordpressのインスタンスをぶらさげようとしてちょっとはまったのでメモ

  • 構成
    • EC2(Amazon Linux 2) + RDS(MySQL) + ALB というごくごくふつうの構成
  • はまった点
    • ふつうにHTTPSのリスナーをもつALB配下にWordpressをいれたEC2をぶらさげたら、インストール画面がHTTPのみのときとなんか違う
    • Chromeのデベロッパーツールでのぞいてみたら mixed content の山になっていた
    • どうやらCSSとかをHTTPで返してくるようだ
  • 解決策
    • ALB(CLBでもいっしょだけど)から転送されてきたときの HTTP_X_FORWARDED_PROTO を見て $_SERVER['HTTPS']$_ENV['HTTPS']on にしてやればいいみたい
    • wp-config.php に下記の構文を入れる
if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
  $_SERVER['HTTPS'] = 'on';
  $_ENV['HTTPS'] = 'on';
}

以上です

3
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
takashi0314
新井ひとみさん推してます
cloudpack
Amazon Web Services (AWS) の導入設計、環境構築、運用・保守をサポートするマネジドホスティングサービス

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
3
Help us understand the problem. What is going on with this article?