LinuxPHPWordpressパソコンのこと

Wordpress "mixed content the page at ' url ' was loaded over https" nginx reverse proxy

1 Mins read

Nginx のリバースプロキシ環境において、フロントエンドの Nginx が 443 (HTTPS) でリクエストを受け付け、内部では 80 (HTTP) でラウンドロビン方式の負荷分散を行っている場合、Chrome で Mixed Content エラー が発生することがあります。

この問題を解決するために、wp-config.php の冒頭に以下の設定を追加すると効果的です。

/** mixed content the page at ' url ' was loaded over https wordpress nginx */
/** プロキシ設定の場合、httpsでリダイレクトするように設定が必要! */
/** HTTP_X_FORWARDED_FOR の環境変数名はAWSなどお使いのサーバー環境により若干変更されている時があるので要確認すること */
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $_SERVER['HTTPS'] = 'on';
}

内部では 80 (HTTP)側の nginx.conf ファイルを操作できる方は、以下の設定でも対応可能です。

どちらかお好みでOK

location ~ \.php$ {
    include fastcgi_params;

    # mixed content the page at ' url ' was loaded over https wordpress nginx
    # プロキシ設定の場合、httpsでリダイレクトするように設定が必要!ここから
    fastcgi_param HTTPS on;
    fastcgi_param HTTP_X_FORWARDED_PROTO https;
    # ここまで

    fastcgi_intercept_errors on;
    fastcgi_pass php-fpm;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Read more
LinuxmacOSRubyパソコンのこと

Rails 7.0.8.7 Updateで起動エラー "Logger::Severity.constants.each do |severity|"

1 Mins read

Ruby 3.2.6

Ruby on Rails 7.0.8.7

起動でこける

原因はgem

gem 'concurrent-ruby', '1.3.5'

Gemfileの末尾に追記して、しばらく固定にしておく

gem 'concurrent-ruby', '1.3.4'

追記したらインストール

bundle install

# Fetching concurrent-ruby 1.3.4 (was 1.3.5)
# Installing concurrent-ruby 1.3.4 (was 1.3.5)

以下ログ

# gem 'concurrent-ruby', '1.3.5' では以下エラーになるので'1.3.4'固定にしておく
#
# bundler: failed to load command: puma (/app-root/vendor/bundle/ruby/3.2.0/bin/puma)
# /app-root/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/logger_thread_safe_level.rb:12:in `<module:LoggerThreadSafeLevel>': uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError)
#
# Logger::Severity.constants.each do |severity|
# ^^^^^^^^^^
Read more
Windows11パソコンのこと日記

リモートデスクトップ 音が出ない Windows11

1 Mins read
  • 状況
    • リモートデスクトップ接続でリモート側のアプリからホストへ音が出ない場合
    • リモート側のSleep後に音が出なくなった場合
  • 環境
    • host側:Windows11 22H2
    • remote側:Windows11 22H2
  • 対応方法
    • remote側のWindowsの検索で「service」と入力
    • サービスアプリをダブルクリックで起動する
    • 「Windows Audio」というサービスを選択し、右クリックから「サービスの再起動」
Read more
macOSパソコンのこと日記

【Mac】ターミナルなど Operation not permitted を回避し開発者仕様にする

1 Mins read

macOS Monterey
Version12.4

■1.「SIP」をdisableに変更
(システム整合性保護(System Integrity Protection: SIP)の無効化)

Macを一度シャットダウン
起動時に「command + R」押下、マークが表示されたら離す
リカバリーモードが起動
上のメニューバーから「ターミナル起動」

# コマンド:「csrutil status」が「enabled」なら
csrutil status

# コマンド:「csrutil disable」を叩く(再起動しないと反映されない!)
csrutil disable

# コマンド:「reboot」にてMac再起動
reboot

■2.ターミナルをファイルフル権限に設定
通常起動後に
「システム環境設定」

「セキュリティーとプライバシー」

「プライバシー」タブの右側「フルアクセス」

「ターミナル」のチェックボックスOn

■3.「.DS_store」を削除&作成不能とする

# .DS_Storeファイル全部削除
sudo find / -name ".DS_Store" -delete
# Finder再起動
Killall Finder

# .DS_Storeファイルを完全に作らない
defaults write com.apple.desktopservices DSDontWriteNetworkStores True
# Finder再起動
Killall Finder

■4.必要ないならiCloud同期しない設定がおすすめ

Read more