Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 让SSL在Mac OS上与Apache/Passenger配合使用;“雪豹”;_Macos_Ssl_Apache2_Ruby On Rails 3_Passenger - Fatal编程技术网

Macos 让SSL在Mac OS上与Apache/Passenger配合使用;“雪豹”;

Macos 让SSL在Mac OS上与Apache/Passenger配合使用;“雪豹”;,macos,ssl,apache2,ruby-on-rails-3,passenger,Macos,Ssl,Apache2,Ruby On Rails 3,Passenger,我有一个带有“雪豹”v10.6.5的Mac操作系统,我正在使用乘客偏好窗格v1.3开发一个RubyonRails3应用程序 要继续开发我的应用程序,我需要SSL支持,但我也有类似的支持 我遵循的步骤来自默认的apache osx安装: 安装乘客和乘客偏好窗格 添加我的Ruby on Rails应用程序(有效) 将我的ca.key、server.crt和server.key创建为 。。。但是在第三步中,我不得不停止编辑/private/etc/apache2/httpd.conf文件,原因如下(有

我有一个带有“雪豹”v10.6.5的Mac操作系统,我正在使用乘客偏好窗格v1.3开发一个RubyonRails3应用程序

要继续开发我的应用程序,我需要SSL支持,但我也有类似的支持

我遵循的步骤来自默认的apache osx安装:

  • 安装乘客和乘客偏好窗格
  • 添加我的Ruby on Rails应用程序(有效)
  • 将我的ca.key、server.crt和server.key创建为
  • 。。。但是在第三步中,我不得不停止编辑/private/etc/apache2/httpd.conf文件,原因如下(有关更多信息,请参阅苹果网站):

    一,。
    端口80应更改为#端口80。

    我还没有找到“端口80”,但我认为这不是一个问题,因为即使它存在于代码中,它也已被注释掉

    二,。
    您需要在端口指令的下方添加以下内容:

    < IfModule mod_ssl.c>
        Listen 443
        Listen 80
    < /IfModule>
    
    由于代码“AddModule mod_ssl.c”不存在(LoadModule已准备好使用),我尝试添加它并重新启动apache2,但我的应用程序不再工作

    四,。
    现在找到“ServerName”指令,并确保其条目包含127.0.0.1。

    ServerName 127.0.0.1
    
    我不知道我是否必须进入它,因为我使用乘客。但是,我在文件中找到了一行代码(已经注释过)#ServerName www.example.com:80”

    关于SSL证书的乘客代码,我认为它必须与

    我认为这是因为指南是很久以前写的。那么,在apache2中使用SSL应该怎么做?

    为了清楚起见,我还包括了与乘客偏好窗格相关的代码

    …/private/etc/apache2/httpd.conf

       LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
       PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2
       PassengerRuby /usr/local/bin/ruby
    
    # Added by the Passenger preference pane
    # Make sure to include the Passenger configuration (the LoadModule,
    # PassengerRoot, and PassengerRuby directives) before this section.
    <IfModule passenger_module>
      NameVirtualHost *:80
      <VirtualHost *:80>
        ServerName _default_
      </VirtualHost>
      Include /private/etc/apache2/passenger_pane_vhosts/*.conf
    </IfModule>
    
    <VirtualHost *:443>
    
      ServerName subdomain.domain.com
      DocumentRoot "/Users/<my_user_name>/Sites/subdomain/public"
      RackEnv development
      <Directory "/Users/<my_user_name>/Sites/subdomain/public">
        Order allow,deny
        Allow from all
      </Directory>
    
      # SSL Configuration
      SSLEngine on
      SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
      SSLOptions +FakeBasicAuth +ExportCertData +StdEnvVars +StrictRequire
    
      #Self Signed certificates
      SSLCertificateFile /private/etc/apache2/ssl/server.crt
      SSLCertificateKeyFile /private/etc/apache2/ssl/server.key
      SSLCertificateChainFile /private/etc/apache2/ssl/ca.crt
    
      SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    
    </VirtualHost>
    
    LoadModule-passenger\u-module/usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/ext/apache2/mod\u-passenger.so
    PassengerRoot/usr/local/lib/ruby/gems/1.9.1/gems/passer-3.0.2
    PassengerRuby/usr/local/bin/ruby
    #由乘客偏好窗格添加
    #确保包括乘客配置(装载模块、,
    #本节之前的PassengerRoot和PassengerRuby指令)。
    名称虚拟主机*:80
    服务器名\u默认值_
    Include/private/etc/apache2/passenger_pane_vhosts/*.conf
    
    …/private/etc/apache2/passenger_pane_vhosts/subdomain.domain.com.vhost.conf

       LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
       PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2
       PassengerRuby /usr/local/bin/ruby
    
    # Added by the Passenger preference pane
    # Make sure to include the Passenger configuration (the LoadModule,
    # PassengerRoot, and PassengerRuby directives) before this section.
    <IfModule passenger_module>
      NameVirtualHost *:80
      <VirtualHost *:80>
        ServerName _default_
      </VirtualHost>
      Include /private/etc/apache2/passenger_pane_vhosts/*.conf
    </IfModule>
    
    <VirtualHost *:443>
    
      ServerName subdomain.domain.com
      DocumentRoot "/Users/<my_user_name>/Sites/subdomain/public"
      RackEnv development
      <Directory "/Users/<my_user_name>/Sites/subdomain/public">
        Order allow,deny
        Allow from all
      </Directory>
    
      # SSL Configuration
      SSLEngine on
      SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
      SSLOptions +FakeBasicAuth +ExportCertData +StdEnvVars +StrictRequire
    
      #Self Signed certificates
      SSLCertificateFile /private/etc/apache2/ssl/server.crt
      SSLCertificateKeyFile /private/etc/apache2/ssl/server.key
      SSLCertificateChainFile /private/etc/apache2/ssl/ca.crt
    
      SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    
    </VirtualHost>
    
    
    ServerName subdomain.domain.com
    DocumentRoot“/用户//站点/子域/公共”
    RackNV开发
    命令允许,拒绝
    通融
    #SSL配置
    斯伦金安
    SSLCipherSuite全部:!ADH:!出口56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
    SSLOptions+FakeBasicAuth+ExportCertData+StdEnvVars+StrictRequire
    #自签名证书
    SSLCertificateFile/private/etc/apache2/ssl/server.crt
    SSLCertificateKeyFile/private/etc/apache2/ssl/server.key
    SSLCertificateChainFile/private/etc/apache2/ssl/ca.crt
    SetEnvIf用户代理“*MSIE.*”nokeepalive ssl不干净关机降级-1.0强制响应-1.0
    
    我刚刚遇到了同样的问题,这就是我为使其正常工作所做的

    按照同样的步骤生成密钥(此外,还提到删除密码短语。我必须这样做才能工作)

    接下来,我执行了以下操作以在Apache上启用SSL:

    在我的雪豹上的“/private/etc/apache2/httpd.conf”文件中有一行:

    # Include /private/etc/apache2/extra/httpd-manual.conf
    
    我刚刚删除了#并保存了文件

    接下来编辑文件(/private/etc/apache2/extra/httpd manual.conf)并确保

    SSLCertificateFile
    SSLCertificateKeyFile
    
    指向您创建的正确密钥文件

    接下来,在同一个文件(/private/etc/apache2/extra/httpd manual.conf)中有一个条目,开始于:

    <VirtualHost _default_:443>
    
    
    
    我不得不注释掉那个文件以及它之后的所有内容(或者你可以直接删除它),直到

    </VirtualHost> 
    
    
    
    进入。该条目与我的站点冲突

    您的虚拟主机条目看起来是正确的,但为了完整性,我将在这里添加我的条目

    我刚刚修改了Passenger PrefsPane为我的站点创建的原始Vhost文件:

    <VirtualHost *:443 *:80>
      ServerName mysite.local
      DocumentRoot "/Users/username/mysite/public"
      RackEnv development
      <Directory "/Users/username/mysite/public">
        Order allow,deny
        Allow from all
      </Directory>
      SSLEngine on
      SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
      SSLOptions +FakeBasicAuth +ExportCertData +StdEnvVars +StrictRequire
      SSLCertificateFile /etc/apache2/sslkey/server.crt
      SSLCertificateKeyFile /etc/apache2/sslkey/server.key
      SSLCertificateChainFile /etc/apache2/sslkey/ca.crt
      SetEnvIf User-Agent &quot;.*MSIE.*&quot; nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    </VirtualHost>
    
    
    ServerName mysite.local
    DocumentRoot“/Users/username/mysite/public”
    RackNV开发
    命令允许,拒绝
    通融
    斯伦金安
    SSLCipherSuite全部:!ADH:!出口56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLOptions+FakeBasicAuth+ExportCertData+StdEnvVars+StrictRequire
    SSLCertificateFile/etc/apache2/sslkey/server.crt
    SSLCertificateKeyFile/etc/apache2/sslkey/server.key
    SSLCertificateChainFile/etc/apache2/sslkey/ca.crt
    SetEnvIf用户代理“*MSIE.*”nokeepalive ssl不干净关机降级-1.0强制响应-1.0
    

    下一次重新启动Apache,您就可以开始了。:-)

    您在苹果网站上关注的文档大约有10年历史,目标是当时随Mac OS X安装的Apache 1.3。这些说明不会完全适用于当前的Apache 2.2安装。请尝试使用Apache文档。如果您尝试在localhost中验证HTTPS连接的对等方,它将使用您的自签名证书工作?应该可以,但由于是localhost测试,我并不太担心安全警告:-)