前提・実現したいこと
前提
※環境を以下に列挙します。
設定しているサーバー:ホスト名を仮にwwwとします。(既存の動作しているwwwからのリニューアルです。)
環境:CentOS7.4、Apache 2.4.34、mod_ssl 2.4.34(いずれもIUSリポジトリから)、OpenSSL 1.0.2k-12(CentOS7.4固有の)
SSLは有償のものを使用。バーチャルホストとして、wwwとhomeの2つを設定しています。
このwwwサーバーにはコンテンツは何も置いておらず、ProxyPassを設定してリダイレクトさせたいサーバーへアクセスを流しているだけのサーバーになります。
リダイレクトさせたいサーバー:ホスト名を仮にprod1とします。
環境:RedHat Enterprise Linux 4.5、Apache、mod_ssl等
実現したいこと:以下の事をwwwサーバーでさせたいと思っています。
1.http://www.test.com -> https://www.test.comにリダイレクト
2.http://www.home.com/intranet -> https://home.com/intranetにリダイレクト(実際のintranetコンテンツはprod1にあります。)
ここに質問の内容を詳しく書いてください。
httpd.conf、ssl.confを設定してApacheは起動しているのですが、以下の事象が発生しました。1
発生している問題・エラーメッセージ
1.http://www.test.comにはアクセスできるが、https://www.test.comにリダイレクトされない
(そもそも、リダイレクトエラーがerror_logに出力されていない)
2.直接https://www.test.comにアクセスすると、画面は表示されない
3.Apacheのエラーメッセージにはよくわからない通知?表示が出ている。
/var/log/error_log
(Apache起動時にメッセージが表示され、サイトにアクセスした際には何もエラーメッセージは書かれません。)
[Mon Oct 15 10:38:30.338799 2018] [suexec:notice] [pid 4360] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Mon Oct 15 10:38:30.358289 2018] [mpm_prefork:notice] [pid 4360] AH00163: Apache/2.4.34 (IUS) OpenSSL/1.0.2k-fips configured -- resuming normal operations [Mon Oct 15 10:38:30.358314 2018] [core:notice] [pid 4360] AH00094: Command line: '/usr/sbin/httpd -D SSL -D FOREGROUND'
該当のソースコード
/etc/httpd/conf/httpd.conf抜粋
##Apache listen port Listen 80 ##choice of modules.d/conf Include conf.modules.d/00-base.conf Include conf.modules.d/00-mpm.conf Include conf.modules.d/00-proxy.conf Include conf.modules.d/00-systemd.conf ##FQDN and port ServerName www.test.com:80 ServerName www.test.com:443 ##symboliklink yes .htaccess none <Directory /> Options FollowSymLinks #AllowOverride all AllowOverride None #Require all granted </Directory> <Directory "/var/www"> AllowOverride None # Allow open access: # Require all granted Require all denied </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None # Require all granted Require all denied </Directory> #<IfModule dir_module> # DirectoryIndex index.html #</IfModule> <Files ".ht*"> Require all denied </Files> ErrorLog "logs/error_log" LogLevel warn <IfModule log_config_module> LogFormat "domain:%V\thost:%h\tserver:%A\tident:%l\tuser:%u\ttime:%{%d/%b/%Y:%H:%M:%S %z}t\tmethod:%m\tpath:%U%q\tprotocol:%H\tstatus:%>s\tsize:%b\treferer:%{Referer}i\tagent:%{User-Agent}i\tresponse_time:%D\tcookie:%{cookie}i\tset_cookie:%{Set-Cookie}o" combined_ltsv </ifModule> CustomLog "logs/access_log_ltsv" combined_ltsv <Directory "/var/www/cgi-bin"> AllowOverride None Options None # Require all granted Require all denied </Directory> EnableSendfile off IncludeOptional conf.d/*.conf TraceEnable off HostnameLookups Off UseCanonicalName Off
該当のソースコード
/etc/httpd/conf.d/rewrite.conf
<IfModule rewrite_module> RewriteEngine On Loglevel alert rewrite:trace8 RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] </IfModule>
該当のソースコード
/etc/httpd/conf.d/ssl.conf
#listen port Listen 443 <VirtualHost 192.168.2.1:80> #http://www.test.com/ ServerName www.test.com ServerAdmin webmaster@test.com ErrorLog logs/www_error_log LogLevel warn ProxyPass / http://prod1.com/ ProxyPassReverse / http://prod1.com/ </VirtualHost> <VirtualHost 192.168.2.1:443> #https://www.test.com/ ServerName www.test.com ServerAdmin webmaster@test.com ErrorLog logs/www_error_log LogLevel warn ProxyPass / http://prod1.com/ ProxyPassReverse / http://prod1.com/ </VirtualHost> <VirtualHost 192.168.2.2:443> #https://home.test.com/ ServerName home.test.com ServerAdmin webmaster@test.com SSLProxyEngine on ErrorLog logs/home-ssl_error_log CustomLog logs/home-ssl_access_log combined_ltsv LogLevel warn BrowserMatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0 CustomLog logs/home-ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" Options All Options -Indexes ProxyPass / https://prod1.com/ ProxyPassReverse / https://prod1.com/ </VirtualHost>
試したこと
1.リダイレクトの設定箇所が問題か
htt.conf内に記載していたrewrite.confの内容をrewrite.confとして外出し->効果なし
2.SSL付きでApacheが起動していない?
/etc/sysconfig/httpd内のOPTIONS=に"DSSL"を付けて起動->効果なし
3.IfModule rewrite_moduleをIfModule mod_rewrite_soに変更->効果なし
他にもいろいろやったのですが、メモしていませんでいた。すいません。
補足情報(FW/ツールのバージョンなど)
なし。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/15 04:51
2018/10/15 06:26
2018/10/15 06:55
2018/10/15 07:50
2018/10/15 08:05 編集
2018/10/15 08:21
2018/10/15 08:41
2018/10/16 06:42