Add a wordpress installation to an existing droplet that is currently running a rails app,

So that the Wordpress site is on a subdomain?

I have seen ways to do this using Heroku but I’m specifically looking for a simple way to add a blog to my rails app hosted at digitalocean and I want to use Wordpress.


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Hello all,

To run a RAILS app or in fact any APP that has a custom port and another application like WordPress you’ll need to use Nginx.

First, use Nginx for the Rails. Create a reverse proxy configuration which allows you to direct traffic on port 80 or 443 to your local port inside of the Droplet where your Rails app is listening.

You can use this guide:

It’s for Jenkins but it can as easily by for Rails. It has the same configuration, you’ll just need to update the port you are using.

After you have Nginx configured for your Rails app, you can add your WordPress application. ALl you need to do is create a new Nginx config in /etc/nginx/conf.d/. Here is a really good tutorial about that:

There are a number of different ways this can be done. It partially depends on how you’ve set up your Rails app. If you aren’t already doing so, you’ll need to put Nginx or Apache in front of the app as a reverse proxy. This will then be used to direct requests to the correct domain.

Our Rails One-Click application uses Nginx. Using that as a base, you’re Nginx configuration would look something like:

server {
    listen   80;
    root /home/rails/public;
    index index.htm index.html;

    location / {
        try_files $uri/index.html $uri.html $uri @app;

    location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ {
        try_files $uri @app;

     location @app {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://app_server;

server {
    listen 80;

    root /var/www/html;
    index index.php index.html index.htm;

    location / {
        # try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php?q=$uri&$args;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

The key thing to remember is that you must set the server_name correctly for both server blocks.

This tutorial will walk you through the WordPress specific bits like setting up the database: