使用apache和passenger在本地主机中使用ssl

发布于 2024-09-15 12:40:47 字数 1252 浏览 11 评论 0原文

我正在尝试使用 apache 和 phusion Passenger 在我的本地主机上配置 SSL。我正在使用虚拟主机。

我在 site-available/myapp 中有以下配置


VirtualHost *:80
  ServerName myapp
  DocumentRoot /home/madhu/ror/myapp/public
  RailsEnv development
   Directory /home/madhu/ror/myapp/public
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
   Directory
VirtualHost


VirtualHost *:443
  ServerName myapp
  DocumentRoot /home/madhu/ror/myapp/public
  ProxyPass / http://myapp/
  ProxyPassReverse / http://myapp/
  ProxyPreserveHost On
  RequestHeader set X_FORWARDED_PROTO 'https'
  Directory /home/madhu/ror/myapp/public
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
  Directory
  SSLEngine On
  SSLProxyEngine On
  SSLCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem
  SSLProxyMachineCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem
VirtualHost

SSL 已启用,一切正常。但是当我转到网址 https://myapp/login 时,它显示“找不到请求的 URL /login在此服务器上”。当我查看 apache 日志时,我发现请求将发送到 /var/www/login 而不是 /home/madhu/ror/myapp/public。这是错误日志


[client 127.0.0.1] File does not exist: /var/www/login

我遗漏了什么吗?请帮忙

谢谢。

I am trying to configure SSL on my localhost using apache and phusion passenger. I am using virtualhosts.

I have the below configuration in sites-available/myapp


VirtualHost *:80
  ServerName myapp
  DocumentRoot /home/madhu/ror/myapp/public
  RailsEnv development
   Directory /home/madhu/ror/myapp/public
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
   Directory
VirtualHost


VirtualHost *:443
  ServerName myapp
  DocumentRoot /home/madhu/ror/myapp/public
  ProxyPass / http://myapp/
  ProxyPassReverse / http://myapp/
  ProxyPreserveHost On
  RequestHeader set X_FORWARDED_PROTO 'https'
  Directory /home/madhu/ror/myapp/public
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
  Directory
  SSLEngine On
  SSLProxyEngine On
  SSLCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem
  SSLProxyMachineCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem
VirtualHost

The SSL is enabled and everything works fine. But when I go to the url https://myapp/login , it says "The requested URL /login was not found on this server". When I look at the apache logs I found out that the request is going to /var/www/login istead of /home/madhu/ror/myapp/public. This was the error log


[client 127.0.0.1] File does not exist: /var/www/login

Is there anything I am missing? Please help

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

您的好友蓝忘机已上羡 2024-09-22 12:40:47

我不得不输入

  ServerName myapp
  DocumentRoot /home/madhu/ror/myapp/public
  RequestHeader set X_FORWARDED_PROTO 'https'
  Directory /home/madhu/ror/myapp/public
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
  Directory
  SSLEngine On
  SSLProxyEngine On
  SSLCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem
  SSLProxyMachineCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem

default-ssl :P 愚蠢的错误

I had to put

  ServerName myapp
  DocumentRoot /home/madhu/ror/myapp/public
  RequestHeader set X_FORWARDED_PROTO 'https'
  Directory /home/madhu/ror/myapp/public
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    allow from all
  Directory
  SSLEngine On
  SSLProxyEngine On
  SSLCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem
  SSLProxyMachineCertificateFile /etc/ssl/certs/Thawte_Server_CA.pem

in default-ssl :P silly mistake

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文