Deploying to DigitalOcean LAMP stack Ubuntu 12.04

Hey all,

I’m trying to deploy a site that I built locally on my mac. For some reason when I activate the Roots Theme, it only shows the HTML and none of CSS. I transferred all of the files to my digital ocean server and setup the vhost like so:

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  ServerName 192.241.142.24/payroll
  ServerAlias 192.241.142.24/payroll
  DocumentRoot /var/www/payroll
  <Directory />
    Options FollowSymLinks
    AllowOverride All.
  </Directory>
  <Directory /var/www/payroll>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All.
    Order allow,deny
    allow from all
  </Directory>
  </Virtual Host>

I also have the .htaccess setup using the default WP config

# 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

So I can’t tell why the Roots Theme isn’t loading correctly. I’m beginning to think the only way around this is to deploy with capistrana but I just wanted to make sure I wasn’t missing anything first.

You don’t need Capistrano. 404 errors in dev console? What do your server logs say?

Which directory have you installed your theme in?

Sounds like a dumb question, but I’ve installed I’ve done it myself before. Worth a quick check.

e.g. app/themes/your-theme-name/

/var/log/apache2/error.log:

|File does not exist: /var/www/app, referer: http://192.241.142.24/payroll/
[error] [client 173.74.49.22] File does not exist: /var/www/app, referer: http://192.241.142.24/payroll/
[error] [client 173.74.49.22] File does not exist: /var/www/app, referer: http://192.241.142.24/payroll/

I’m still getting the hang of debugging server stuff but obviously this is the wrong path, it’s missing my “payroll” project directory.

My theme directory is properly named too. Everything works locally, it’s just when I put it on the server that I have issues. And yes I do get 404 errors when I try to visit other pages.

Don’t seem like this is Roots related… does twentythirteen load okay?

Oh yes I see, the other theme’s hit 404’s too. Well how come I only have this issue when I am using Bedrock/Roots?

Doesn’t seem like this has anything to do with Bedrock, either. Does a normal WP installation work okay? Boils down to your webserver configuration not being setup correctly.

Yes normal WP installation works, I just changed my permalinks structure back to default and now I can get to other pages using the TwentyFourteen theme. But the Roots theme is still appearing inactive. http://imgur.com/vFDZ7gP

We’re thinking this might be an issue with Bedrock and subdirectory installs. This thread has a similar setup and maybe the same problem: Broken Theme Directory

I put my theme in the /wp/wp-content/themes/ directory and that got roots to work. Now I’m just having issues with uploads, I changed the uploads directory from /app/uploads/ to /wp/wp-content/uploads/ and It’s still not uploading media because of permissions issues. I chmod 777 everything in frustration and still no success.

I’m going to try a regular wordpress install and then just pull down the roots theme and see if that will suffice.

Just to clarify, putting the theme in /wp/wp-content/themes/ is good for debugging purposes, but not a real solution. Nothing should be modified in wp since it’s managed by Composer. So if there is an issue with Bedrock, it will be fixed.

Unless I missed something, why are you changing the uploads path? The default is app/uploads and should stay that way, because once again, nothing should modify wp/.

I was doing that for debugging purposes because of what the guy had done in that thread you linked, Broken Theme Directory

So I followed what Foxaii was saying,

I haven’t been able to replicate this and have managed a Bedrock install at both localhost/wordpress/ and localhost/wordpress/dev without any issues.

I would guess that the WP_CONTENT_DIR is being set incorrectly, which is defined here. Also note where the $root_dir variable is set near the top.

If you troubleshoot some of those defines we may have something more to go on.

I output the $roots_dir in /config/application.php and got /var/www/payroll, and then it appends /app starting at line 25? So that is right… right?

Should be correct since your doc root is /var/www/payroll. Whats your WP_HOME and WP_SITEURL set to?

In the .env:

WP_HOME=http://192.241.142.24/payroll WP_SITEURL=http://192.241.142.24/payroll/wp

Can you please try moving one of the default WordPress themes into the /app folder and see if you get the same issue?

Yes the same issue happened to TwentyFourteen:
http://imgur.com/6XPEZn7

Edit: I have circumvented issue for now buy using normal wp install and then pulling in Roots.

Can you try setting up your host like below, and restarting Apache?
I’m convinced this is a server config issue.

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  ServerName 192.241.142.24
  DocumentRoot /var/www/
  Alias /payroll /var/www/payroll
  <Directory />
    Options FollowSymLinks
    AllowOverride All.
  </Directory>
  <Directory /var/www/payroll>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All.
    Order allow,deny
    allow from all
  </Directory>
  </Virtual Host>

I think I had the same problem with my install, and after a lot of trying I found out that my Apache Rewrite module was not enabled. This is what fixed my problem finally:

sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
ls /etc/apache2/mods-enabled/php*

I also posted in my blog about this issue

1 Like