opens the default Apache "It works!", but IP-address goes to Ruby on Rails app through nginx

December 28, 2014 1.6k views

I followed the tutorial for 1-click installation of Ruby on Rails + nginx + Unicorn.
Then I followed this tutorial to set up DB, deploy app and run it.
Everything works ok only, when I goes to http://IP-address, but when I added a domain name to DNS in DO dashboard and tried to go to I see the default Apache "It works!" page. http://IP-address still works and go to nginx -> Unicorn -> Rails app.
I've tried to stop Apache server with "/etc/init.d/apache2 stop" and other methods, but receive "No apache MPM package installed".

My "/etc/nginx/sites-enabled/default" is default (I only added to servername):

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;


Thanks for any help!

  • This is extremely strange behavior. Generally Apache and Nginx should not be able to run at the same time if they are both bound to port 80. What's the output of netstat -plunt ? Do you need both Apache and Nginx? I'd try uninstalling Apache with sudo apt-get remove apache2

    Is it possible that the domain record is pointing to a different server entirely? Apache is not installed by default on the Rails One-Click app. Does the output of dig +short match the IP address of the droplet?

  • I don't know how, but when I moved this configuration to another Droplet through snapshot, and made changes in DNS to new IP, everything started to work. I've noticed several strange behaviors, while doing this:

    1. I named the first Droplet "", and when I tried to connect to it through, I saw this Apache's "It works!" page. But when I connect another domain through DNS, everything worked ok with it.
    2. When I made new Droplet through snapshot and made DNS changes, all domain names started to work and they went to this new Droplet. But when I delete old droplet, all domain names broke. They started to work after several hours, when DNS changes applied, as I understand.

    In fact, maybe the problems were on DNS side. But I've waited enough with "It works!" problem, and the second domain started to work, while the first shows "It works!". Does it matter, how you name your Droplet? Maybe, the problem was in this "" name?

Be the first one to answer this question.