Building A Niche Site … Kind Of
I own a few domains that I have hopes of using at one point or another. One that I tried to do something with once already (and failed) is marketingbythenumbers.com. You’ll notice I’m not linking to it because, as of this post, it doesn’t exist. There are 2 reasons why.
First I had it hosted on Rackspace and during transition of changing banks and debit cards I neglected to update my payment information. This is bad. So the powers that be ate the website. In truth they ate this one too (this was actually a bigger loss for me). So I lost all the content I had put into place.
Second I was building the site anew on Google Cloud this morning and after getting things into a launch-able position my WordPress credentials stopped working. I’m not sure why but because I didn’t install a mail system on my server I couldn’t recover them. So that was about 2 or 3 hours of work that was lost.
Because of my experience this morning I wanted to go through a few things I learned about putting together a WordPress site on Google Cloud without using the Deploy feature.
Quickly, here was the setup I used: zone – US Central A, size – g1 small, boot from image ubuntu-14.04-trusty, everything else default.
After the server was up and running I logged into the command line and installed Apache2, mySQL, and PHP. After restarting the server I installed WordPress and set up a database. Here is where I think I went wrong. I should have waited to set up WordPress until I had completely set up the server.
Once the database was set up I started setting up WordPress (connecting the database and installing all the base tables). I realized here that there was on wp-config.php file and the setup of the server didn’t allow automatic creation of one. So I added it manually.
Once everything was finally set up I started creating a post. I wanted to add an image, but couldn’t. I realized I had to set the permissions of wp-content. So after some checking I used this command:
sudo chmod -R 775 wp-content
What this command does is recursively changes the permissions of the wp-content (and all sub file and folders) to 775, meaning it’s readable, writeable, and executable by the owner and owner group and only readable and executable by the world. If you want to lean more about file permissions you can see more on the Wikipedia article.
One of the things I always forget before my first post on a new WordPress install is changing the permalinks. Meaning creating URLs to posts that are pretty and readable. So after my first post I went to make the change and ran into another issue, WordPress couldn’t write to .htaccess. I looked in the file structure and found no file there, so once again, I had to create one. And once again I changed the permission but to 666 (readable and writeable on all levels) using this command:
sudo chmod 666 .htaccess
I used 666 because it is the recommended permission level according to WordPress documentation. You can read more about it here.
This change worked … kind of. It actually sent me to the correct URL, but it was a 404 page. Which is bad. Looking into it I found that I had to change my httpd.conf file. Or in Apache2 the apache2.conf file, located at:
The key change that needs to be made is in the <directory /var/www> block. You need to have AllowOverwrite all as opposed to the default AllowOverwrite None.
Another key is to make sure you have the mod_rewrite module set up and enabled. This article from StackOverflow is a good resource to make sure it’s enabled.
Now with everything set up the way I wanted it I pointed my domain at the new server. Once it started showing up I told WordPress to use the domain rather than the IP and at this point I had to log in. Now is where I ran into the issue with my credentials. I still don’t know why they didn’t work, but alas they didn’t. If I had a mail server installed and set up correctly I should have been able to recover the password. But not having a lot of experience with it and my test not working I chose to abandon the project for now.
While I did lose some work time I still learned plenty.
First about permissions. Make sure they are set up. A command line install of WprdPress isn’t set up automatically.
Second get all my modules set up first (including a mail system) before installing WordPress. It makes the process smoother.
I want to initially use a password I know rather than a secure one while setting things up. Just in case something weird happens I can be sure I know what the password should be. I’m sure this isn’t as important, but it’s a new workflow for me.
Overall it was a good experience. though it would be better if Google would just let me deploy a second WordPress install automatically on one project. But maybe it’s smarter to separate these out anyway? That is a plan for another time.