Question

Display Pages after everything is setup.

I’ve setup my virtual host http://prntscr.com/chb2jq . Thin from Sinatra is running. http://prntscr.com/chb2v5 . What am I missing to display my Sinatra pages. I’m getting no errors so it should be something small I am missing. I can display the page but only the default is the virtual host page I made.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thank you this answered my question

Hi!

Based on the virtual host page that you’re getting, I’m assuming that you followed this tutorial to set up Apache. If so, your virtual host config should look like this:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

You’ll want to configure Apache to reverse proxy all requests to example.com to your Sinatra app which is listening on localhost on port 8080. To do that, replace the DocumentRoot directive with the following:

    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

Finally, restart Apache so that the changes take effect:

sudo service apache2 restart

If that does not work, check the error log for any errors (the following command prints the last 40 lines of Apache’s error log):

sudo tail -40 /var/log/apache2/error.log