http://www.example.com、http://example.comをhttps://example.comにリダイレクトします。Rails Passengerでhttpsとwwwをリダイレクトし、Amazon LinuxでApacheにWordPressをインストールする
https://example.comでホストされているアプリケーションは、Rails Passengerアプリです。
私は/var/www/html/blog
にワードプレスのインストールを持っており、/blog
から/var/www/html/blog
にエイリアスを付けました。https://example.com/blogはワードプレスのブログを実行します。
私が欲しいしかし、すべてが働いているではない:
今:
- http://www.example.comがhttps://example.comに起こっている、これは良いです。
- http://example.comはhttps://example.comにはありません。
- https://www.example.comはhttps://example.com
- https://example.com/blogするつもりはない、このようなコンソールで例外が投げている:罰金
Mixed Content: The page at 'https://example.com/blog/' was loaded over HTTPS, but requested an insecure script 'http://xx.xx.xxx.xxx/blog/wp-includes/js/wp-emoji-release.min.js?ver=4.6.1'. This request has been blocked; the content must be served over HTTPS. e @ (index):23
- http://example.com/blogランを、私はそれがhttps://example.com/blogにリダイレクトする必要があります**
- http://www.example.com/bloghttp://example.com/blog ** にリダイレクト
**ポイント5と6は、ワードプレスのURLをhttp://example.comに設定したためです。 https://example.comに設定すると、無限ループに陥ります。
Apacheの設定を変更する方法についてアドバイスを受けることはできますか?
/etc/httpd/conf/httpd.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.3.3/gems/passenger-5.1.0/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.3.3/gems/passenger-5.1.0
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby
</IfModule>
<VirtualHost *:80>
ProxyPreserveHost On
# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/example/public
# Redirect/https://example.com
PassengerRuby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby
PassengerFriendlyErrorpages on
# JkMount /tc* node1
# JkMount /intro* node1
# Relax Apache security settings
<Directory /var/www/example/public>
RailsEnv production
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
# Require all granted
RewriteEngine On
RewriteBase/
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] OR
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</Directory>
<Directory /var/www/html/blog>
PassengerEnabled off
# Makes Wordpress's .htaccess file work
AllowOverride all
</Directory>
</VirtualHost>
Alias /blog /var/www/html/blog
Alias /.well-known/acme-challenge/ /var/www/example/.well-known/acme-challenge/
`
/etc/httpd/conf.d/ssl.conf
LoadModule ssl_module modules/mod_ssl.so
Listen 443
SSLPassPhraseDialog builtin
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
<VirtualHost _default_:443>
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLProxyProtocol all -SSLv3
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
SSLProtocol All -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
# to run in dev mode
RailsEnv production
# Be sure to point to 'public'!
DocumentRoot /var/www/example/public
# define server details
ServerName example.com
#ServerAlias www.example.com
# rails needs the header for its own processing
RequestHeader set X_FORWARDED_PROTO 'https'
# this is just passing a proxy to a localhost server
# ProxyRequests Off
# ProxyPreserveHost On
# <Proxy *>
# Order deny,allow
# Allow from all
# </Proxy>
# ProxyPass/http://localhost/
# ProxyPassReverse/http://localhost/
#<Directory /var/www/html/blog>
# Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# allow from all
# Require all granted
#</Directory>
</VirtualHost>
あなたは[正常にワードプレスブログ]セットアップあなたを(http://www.wpbeginner.com/べきwp-tutorials/how-to-add-ssl-and-https-in-wordpress /)を使用して、HTTPを使用するようにします。私はまだRadiantやRefineryをWPの杭の上に置いています。 – max
私はリバースプロキシとWordPressのインストールを指し示すことが必要だったので、それはまっすぐではなかったと思います。 WordPressは、あまり知られていないエンジンでは手に入らないカスタムテーマやプラグインを提供しています。 –