Note that there are some explanatory texts on larger screens.

plurals
  1. POHosting Rails app on Thins, Nginx on a sub uri, behind a reverse proxy
    primarykey
    data
    text
    <p><strong>Background</strong></p> <p>For my work, we have two different networks, the developers network, and the general company network. I need to expose the rails app to both, running under a sub uri so that the people on the general network can get to the app from foo.bar.com/{app_name}, and on the developer network from http://{server_name}.{dev_network}.dev/{app_name}. Sadly, we are not allowed to use Passenger, as this is an enterprise application.</p> <p>Currently, I have the app running on a sub uri, and able to be accessed from both networks, but I am running into errors. I will list the errors I am seeing, then the nginx config I have created, as well as the rails_app config to work with the sub uri.</p> <p><strong>Problems</strong></p> <ul> <li>Going to {app_name}/foo/1 - any images on page are being fetched from {app_name}/foo/{app_name}/assets...... This is only happening for the show pages of the RESTful services. </li> <li>Refreshing the page, on either network, reloads the page, but removes all styling and js files attached to that page. Going to another link does not effect the styling, except for the issue noted above. </li> </ul> <p><strong>Configurations</strong></p> <p>Nginx VHost in sites-available, symlinked to sites-enabled. </p> <pre><code>upstream claxon { server 127.0.0.1:3000; } server { listen 80; server_name claxon; root /var/www; location ~* ^/claxon/ { alias /var/www/claxon/public; proxy_pass http://claxon; } location ^~ /assets/ { root /var/www/claxon/public/claxon; } location ^~ /original_user_images/ { root /var/www/claxon/public/claxon; } } </code></pre> <p>Rails App</p> <p>config/initializers/mount_location.rb</p> <pre><code>if Rails.env.production? Rails.application.config.relative_url_root = '/claxon' end </code></pre> <p>config.ru</p> <pre><code>map Rails.application.config.relative_url_root || '/' do run Rails.application end </code></pre> <p>config/environments/production.rb</p> <pre><code># Configures assets to be compiled under public/claxon/assets config.assets.prefix = 'claxon/assets' </code></pre> <p><strong>Additional Details</strong></p> <ul> <li>This app is being deployed to the server using capistrano, and the current folder is being symlinked to the /var/www/claxon folder.</li> <li>This app uses carrierwave for user image uploads. </li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload