简体   繁体   English

使用Apache,Puma,Ubuntu进行Rails SSL设置

[英]Rails SSL setup with Apache, Puma, Ubuntu

I'm having trouble setting up my Rails application to successfully use SSL. 我在设置Rails应用程序以成功使用SSL时遇到麻烦。 The stack is using apache, puma and ubuntu. 堆栈正在使用apache,puma和ubuntu。 My app is running on port 3000. 我的应用程序在端口3000上运行。

Without SSL I had the app up and running great. 没有SSL,我的应用程序将运行良好。 Now, the only thing shown at the my URL is the /var/www/myapp/public directory listing. 现在,我的URL上显示的唯一内容是/var/www/myapp/public目录列表。 I just can't get my Rails app to show. 我只是无法显示我的Rails应用程序。

The app is successfully redirecting all http traffic to https . 该应用程序已成功将所有http流量重定向到https

Can anyone with a successful setup share their sites-available config files, or suggest changes to mine below? 设置成功的任何人都可以共享其sites-available配置文件,或者在下面建议对我的更改进行建议吗? I have a feeling there is a single line somewhere I'm missing. 我觉得我想念的地方只有一行。 This is my first time trying to get an SSL cert rails app server up and running. 这是我第一次尝试启动并运行SSL cert rails应用服务器。

I don't understand how my app running at port 3000 is supposed to show up when viewing the site via SSL on port 443. 我不明白在端口443上通过SSL查看网站时,应该如何显示在3000端口运行的应用程序。

Here is my sites-available setup: 这是我的sites-available设置:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin admin@<MYAPP.COM>
                ServerName <MYAPP.COM>

                DocumentRoot /var/www/<MYAPP>/public

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                SSLCertificateFile      /etc/ssl/certs/<MYAPP.crt>
                SSLCertificateKeyFile   /etc/ssl/private/<MYAPP.key>

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
        </VirtualHost>
</IfModule>

Been banging my head against Google for the last 5 hours. 最近5个小时,我一直在与Google交锋。 Any help is much appreciated. 任何帮助深表感谢。

You need to configure apache as a reverse proxy. 您需要将apache配置为反向代理。

ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM