Zima
By:
Zima

Migrated Hosting to Droplet — Website Not Public — How Do You Make It Live?

April 28, 2015 1.5k views
WordPress FAQ

I migrated my contents and website following the LAMP installation.

Everything works fine and I can see my website, posts, and linking structure via the admin password from terminal.

How do I make my wordpress website live? The homepage is coming up in incognito and the linking is not loading.

1 comment
6 Answers

Here's the case. I migrated hosting from shared to DO. I installed the site + database and when I log into admin on Wordpress. All the links are working.

Now: http://henksaenen.com/ works.
But: http://henksaenen.com/recipe/chocolate-pie/ does not.

Also, when updating Wordpress it asks for FTP password. Which does not work either.

Is something off with my htaccess or host files need to be adjusted?

Thank you in advance.

cc @thinkingmedia

  • You have Apache configured wrong. So the rewrite and file permissions are not working. I'll try to give you some instructions on how to setup Wordpress for DO.

    First, make sure that the rewrite mod is enabled in Apache. It should be on by default.

     $ a2enmod rewrite
    

    Next, we'll create a configuration for the website so that it runs out of /var/henksaene

    $ cd /etc/apache2/sites-available
    $ nano henksaenen.conf
    

    Next, copy and paste this text into the file. I've renamed things to match your config.

    <VirtualHost *:80>
        ServerName henksaenen.com
        ServerAlias www.henksaenen.com
    
        DocumentRoot /var/henksaenen
        <Directory /var/henksaenen>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/error.henksaenen.log
        CustomLog ${APACHE_LOG_DIR}/access.henksaenen.log combined
    </VirtualHost>
    

    Note, that this is for non-SSL only.

    Apache will write separate logs for this domain. Also, note that I made www an alias. So that Wordpress will load for both henksaenen.com and www.henksaenen.com. Which one is the default depends upon your WP config.

    The import thing is AllowOverride All because by default Apache ignores the .htaccess file. Which has the rewrite rules for WP. So you have to allow .htaccess to override settings.

    Now, let's assume you currently have all your Wordpress files located in /var/www/html. Let's move them to /var/henksaenen, and give the www-data user the ownership.

    $ cp -R /var/www/html /var/henksaenen
    $ chown -R www-data:www-data /var/henksaenen
    

    Everything is ready, but we didn't touch the database. I'm going to assume you already have that part done. If the database doesn't work. Let me know, and I'll walk you through the steps of importing a SQL dump of the WP site. The only other way to migrate the data is via a WP xml export (which can be tricky).

    So enable and restart apache.

     $ a2ensite henksaenen
     $ service apache2 restart
    

    You should be good after that.

Thank you so much for this @thinkingmedia

I went head and followed this and had issues once again. The site went into a white screen with Index, Name, Size, Description, etc.

I went back to the config file:

<VirtualHost *:80>
    ServerName henksaenen.com
    ServerAlias www.henksaenen.com

    DocumentRoot /var/www
    <Directory /var/www>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.henksaenen.log
    CustomLog ${APACHE_LOG_DIR}/access.henksaenen.log combined
</VirtualHost>

And changed it to WWW. Do I have to wait for the site to copy over to the new dir or should it work right away?

Finally, I'm troubleshooting the automatic updates. Are there any permissions that might be carried over from the old host/admin-wp?

Regards-

sudo chown username:www-data /var/www -R 
sudo chmod g+w /var/www -R

Worked for me!

  • I'm glad you got it working.

    The permissions for the files must have been wrong, but I don't know how that could have happen.

    How did you copy the WP files onto the server?

@thinkingmedia the naughty way. I couldn't get a good backup outside of the SFTP version / database backup. It hasn't been smooth, but it's working for the most part...

Have another answer? Share your knowledge.