Display Pages after everything is setup.

September 12, 2016 1.1k views
Sinatra Apache Applications Deployment Ubuntu

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.

2 Answers


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

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
by Justin Ellingwood
The Apache web server is the most popular way to serve web content on the internet. Apache has the ability to serve multiple domains from a single server by using a mechanism called "virtual hosts". If a virtual host is configured correctly for each domain, the web server can correctly route traffic to the appropriate files based on the domain name requested. In this guide, we'll demonstrate how to configure Apache virtual hosts on an Ubuntu 14.04 VPS.

Thank you this answered my question

Have another answer? Share your knowledge.