bob182605
By:
bob182605

Rebooted droplet, virtual host not being reconized

July 30, 2014 2.7k views

Hi there, I had a ruby on rails application running just fine on my droplet, rebooted the server with a reboot now command (in console), and now that it's back up. It's going to This file is located in /home/rails/app/views/home/index.html.erb, and not the virtual host path. Any help would please be apprecitated... and fast. Thanks

2 comments
  • nothing has changed in my apache config that was working. My site is at /var/www/sites/yadayada

    Here's what I get when I restart the service

    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    Action 'start' failed.
    The Apache error log may have more information.

  • That means there is something listening on port 80. You can find out what program is using the port by running:

    sudo netstat -plutn | grep 80
    
3 Answers

Was just looking at there, here's what's running

tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 833/unicorn.conf -E
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 776/nginx: worker p

I stopped apache and tried to restart, now I get this

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80

  • It looks like Nginx is already bound to port 80. Run:

    service nginx stop
    service apache2 start
    
  • You can also stop nginx from starting at boot by running:

    sudo update-rc.d -f nginx remove
    

Andrew's response was right in my ordeal, but Kamal helped me see what was going on initially.

For those of you who get this in the future. What append was, after I rebooted the droplet, the service nginx (in my case) took over port 80, which is my default port for apache. I've seen posting about killing whatever service on that port to kick out whatever took your port # or to config a new port # for your vitual hosts. All it took in my case, was stopping the nginx service, and then starting up apache. BOOB... DONE. Thanks for your help everybody.

This is awesome.

Basically digitalocean automigrated my droplet when they upgraded it. All my sites suddenly had the 'Welcome to Nginx' default message. Wtf....

Anyways, after an hour of googling and experimenting, I came upon this thread which solved everything.

My question is, why does auto-migrating a droplet make Nginx the default webserver listening on port 80???? Thats a serious fail on digitaloceans part, no?

Have another answer? Share your knowledge.