![ruby on rails(SLES)中的 Apache ssl 连接](https://linux22.com/image/736040/ruby%20on%20rails%EF%BC%88SLES%EF%BC%89%E4%B8%AD%E7%9A%84%20Apache%20ssl%20%E8%BF%9E%E6%8E%A5.png)
现在(Rails 版本:3.2.13,Ruby 版本:2.1.9p490)我有一台 sles 机器,并且我有以下文件可以手动从 http(可以工作)到 https(不工作)连接:
- cacert.crt
- intermediatcacert.crt
- rootcert.crt
- key.pem
我从一位前同事手中接管了这个系统,但我真的不知道如何正确配置它。在其中default-ssl.conf
我插入了上层文件的路径,但当我重新启动 apache 时它不起作用。
这些是以下配置文件:
/etc/apache2/vhost.d/default.conf
<VirtualHost *:80>
LoadModule passenger_module /home/xxx/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/xxx/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41
PassengerDefaultRuby /home/xxx/.rvm/gems/ruby-2.1.10/wrappers/ruby
</IfModule>
DocumentRoot /home/xxx/yyy/public
ServerAdmin [email protected]
ServerName mywebsite.com
ErrorLog /var/log/apache2/error_log
CustomLog /var/log/apache2/access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
<Directory /home/xxx/yyy/public>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Options -Multiviews
RailsEnv development
</Directory>
RewriteEngine On
RewriteRule "^/?$" "http://mywebsite.com/"
</VirtualHost>
这里default-ssl.conf
<IfDefine SSL>
<IfDefine !NOSSL>
<VirtualHost _default_:443>
LoadModule passenger_module /home/xxx/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/xxx/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41
PassengerDefaultRuby /home/xxx/.rvm/gems/ruby-2.1.10/wrappers/ruby
</IfModule>
DocumentRoot "/srv/www/vhosts/default-ssl"
DocumentRoot "/home/xxx/yyy/public"
ServerName mywebsite.com:443
ServerAdmin [email protected]
ErrorLog /var/log/apache2/error-ssl_log
TransferLog /var/log/apache2/access-ssl_log
CustomLog /var/log/apache2/ssl_request_log ssl_combined
# <Directory "/srv/www/vhosts/default-ssl">
# Options FollowSymLinks
# AllowOverride None
# Order allow,deny
# Allow from all
# </Directory>
# RackBaseURI /xxx
<Directory "/home/xxx/yyy/public">
Order allow,deny
AllowOverride all
Allow from all
Options -Multiviews Indexes
RailsEnv production
</Directory>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!MD5:@STRENGTH
SSLCertificateFile /etc/apache2/ssl.crt/cert-xxx.pem
SSLCertificateKeyFile /root/key.pem
SSLCertificateChainFile /etc/apache2/intermediatecacert/intermediatecacert.crt
SSLCACertificateFile /etc/apache2/rootcert/rootcert.crt
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/srv/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
RewriteEngine On
RewriteRule "^/?$" "https://mywebsite.com/"
</VirtualHost>
</IfDefine>
</IfDefine>
我错过了什么?
提前谢谢您!