I'm having trouble setting up my Rails application to successfully use SSL. The stack is using apache, puma and ubuntu. My app is running on port 3000.
Without SSL I had the app up and running great. Now, the only thing shown at the my URL is the /var/www/myapp/public
directory listing. I just can't get my Rails app to show.
The app is successfully redirecting all http
traffic to https
.
Can anyone with a successful setup share their sites-available
config files, or suggest changes to mine below? 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.
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.
Here is my sites-available
setup:
<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. Any help is much appreciated.
You need to configure apache as a reverse proxy.
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.