Search code examples
wordpressapachelampdigital-ocean

WordPress in var/www/html not loading anything (on digital ocean)


I'm trying to install my godaddy wordpress site on digital ocean from backup. I installed a digital ocean ubuntu droplet just as instructions described on digital ocean:

  • install apache2, PHP, mysql, and wordpress.
  • I added in my data to the mysql database, and it works because my /phpadmin link was accessible and my tables were present
  • I set config to first look for index.php
  • I copied all the wordpress files /wp-admin /wp-content /wp-includes and other files of that nature into the ~/var/www/html dir
  • I copied the apache index.html file into ~/var/www

When I go to my site.com/ it goes to the /index.html apache file, but nothing else. On my local host I accessed /phpadmin but when I changed name servers example.com/phpadmin didn't work. I tried example.com/html/index.php or variations to no avail.

Here is my example.com.conf file, please let me know anything you think I missed:

exmaple.com.conf

<VirtualHost *:80>
     ServerName example.com
     DocumentRoot /var/www
</VirtualHost>
<VirtualHost *:80>
     ServerName www.example.com
     Redirect permanent / http://example.com/
</VirtualHost>

000-default.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Note: When I did install WP new, it went into ~/root/wordpress if that matters


Solution

  • The problem was 2 fold:

    My files should have been in the var/www dir and not the var/www/html, I don't know why because all tutorials say otherwise.

    I didn't have permissions to be given to anyone having a GET request. My friend helped me, I believe this is what he did in command prompt,

    first in var/www/html

    cat /etc/pa

    cat /etc/passwd | grep www

    chown -R www-data:www-data ./

    then in var/www

    mv ./html/*.* ./

    ls -aslh html/

    rm -rf html/