Sign up Sign in Samples Blog contact support
Installing a Web Server

+On GNU Linux

Install a web server Nginx or Apache

To use a different webserver, please see Ruby on Rails documentation. (And let us know how it goes!)

 

Wagn on Nginx

Nginx and Passenger

 

You will need an http server to run your applications. Nginx is fast, lightweight and easy to configure and Phusion Passenger module makes Nginx and Rails integration painless. Firstly, install Passenger gem:

 

$ sudo gem install passenger

 

and then, install Nginx with compiled Passenger module:

 

$ sudo passenger-install-nginx-module

 

*depending on the system you are running the module needs ssl to work so read the instructions on screen to what it says, on Debian it was:

$ sudo apt-get install libcurl4-gnutls-dev

 

Choose the recommended install mode.

 

Now, open the Nginx configuration file (/opt/nginx/cong/nginx.conf if you haven’t changed it during installation).

 

$ sudo nano /opt/nginx/conf/nginx.conf

 

Let’s change some default config. Change worker_processes to be equal to number of CPU cores. You can also enable gzip compression. Just add following lines:

 

gzip on;

gzip_vary on;

gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

 

* parts from http://karolgalanciak.com/blog/2013/07/19/centos-6-4-server-setup-with-ruby-on-rails-nginx-and-postgresql/

 

Wagn on Apache

To set up wagn behind an Apache webserver, we recommend using Phusion Passenger. In general, you will follow the instructions for deploying a Rack-based Ruby application.

 

Following the above example, your apache config might look something like this:

 

<VirtualHost *:80>
  ...
  DocumentRoot /srv/mywagn/current/public
  <Directory /srv/mywagn/current/public>
          AllowOverride all
          Options -MultiViews
  </Directory>
</VirtualHost>

 

 You will also need to make sure that the apache user (usually www-data) has read access to config.ru and read/write access to your log, tmp, and file directories

 

 

Optimizing

 

The above should help you get wagn working, but you'll have to do a bit more to make it fast.

  1. memcache. This is vital for a high-performing Wagn site.

    To configure wagn for memcache, add this to your Gemfile:
    gem 'dalli'
    and edit config/application.rb with the following:
    config.cache_store = :dalli_store, []
  2. mod_xsendfile. File and Image cards process permissions before sending the file.  This makes that fast.
  3. mod_expires. Makes use of wagn's non-expiring assets so images, stylesheets, and javascript don't slow down page loads at all.
  4. You'll need to enable mod_headers so that the ht_access will work (Headers directives)
  5. Also, you'll need to symlink to the gem's public directory if you're running a version older than 1.13 This should happen automatically whenever you run `wagn update`, but you can also do it manually using `rake wagn:update_assets_symlink

+On Mac OS X
how to install nginx and apache in MacOS

+Windows
to be added