Menu Close

Category: WordPress (page 2 of 4)

Wordpress tips and recommendations

How to See What’s Happening On Your Site in Real-time Using Your Log File

Have you had a look at your website’s log file lately? No? Let me tell you, once you set your eyes on that thing you’re going to have trouble tearing yourself away. It will show you every file your Apache server is fetching, as it happens. This means if someone is visiting your website, you’ll see “GET nameofwebpage.com/specificpost.html,” and it will show you that as it happens in real time. You can see if the next-random-user of your website bounces, or if their IP address goes on to click on something else, and what that something is, and how long they stay there. Creepy-awesome, isn’t it?

Here’s how you do it:

Baby Simple Instructions on How To Access Your Log File

First, you’re going to need a command-line program. The Windows one won’t do, as that’s just going to give you DOS. I recommend Putty. Go to http://putty.nl and find the download page. Putty is such a simple little file it doesn’t unpackage anything; when you save it that is the install. So be sure to save it wherever you plan on accessing it.

Now that you have Putty, open it. In the box that pops up, type the website you use to get on your site using FTP. At the bottom of the screen, click “Open.”

The black box that pops up is where your log is going to read out. It should say Login. Give it the username you use to login to FTP and, after hitting Enter, the password that goes with it.

With me so far? You’re now logged into your website on the command-line.

Now type: tail -f /var/log/ but don’t hit Enter just yet!

I can’t tell you exactly what to type because I don’t know how it is written on your site. We’re going to get Putty to tell us by using the Tab key. Hit it once and it will automatically complete the line if there is only one option with what you’ve typed so far. Hit it a second time, and it will list all ways that the file you’ve started typing can be completed.

So after tail -f /var/log/ try typing ht and hit tab twice.

Did tail -f /var/log/httpd/yoursite come up?

If yes, sit tight while I catch the others up. If that doesn’t work, backspace back to tail -f /var/log/ and try adding ap and hitting tab twice. Hopefully you’ll see it tab-complete to apache/thenameofyoursite. If there are too many to list, start typing the name of your site, and hit tab once to get it to complete the name of your site. So far, your screen should either say:

tail -f /var/log/httpd/yoursite

OR

tail -f /var/log/apache/yoursite

If you were sitting in the back throwing spitballs, you may be able to type one of the commands right there to get caught up. But still, don’t hit Enter just yet! We’re almost there.

Now when you hit tab the second time, one of the options should have the word “log” in it. If there are a bunch of them with numbers, just type out the simple one without any numbers. You could always copy-paste this exactly, once you know what to type. I’m using the tab-complete technique because it’s faster, it will tell you what to type if you don’t know, and most importantly, you can be sure everything is spelled correctly. The biggest pitfall of the command-line is that one spelling error and not a thing works. By having Putty finish the command with the Tab key, you have Putty spell it out for you.

Once you have the entire command, it will look something like this:

tail -f /var/log/httpd/yoursite_log

Or possibly the same thing, with “apache” instead of “httpd”

NOW, hit Enter.

Is there a bunch of gobbledegook flowing up and off the screen? Congratulations, that’s your Apache server’s log! I like to hit Enter a bunch of times so there’s a big blank space where I am looking. Mostly, what you will see on the screen will be an IP address (who’s checking out your page) followed by the command and file (the webpage they are accessing).

You can use this same process to figure out why something on your site isn’t working. Let’s get to that next.

How to Access Your Website’s Error Log

Say, for example, that you’ve created an .htaccess file and when you try to use it you keep getting a message like “Server Access Error.” There’s a log of that error, and you want to see it to try to unravel why your page isn’t working. To get to the Error Log, do exactly what we did above, all they way up to the part where you are tab-completing to get the name of your site. But instead of choosing the Log file, type an e, hit Tab and, if that doesn’t complete the line, hit it again to see your options. You want the one that says Error. So you’re here:

tail -f /var/log/httpd/yoursite …[Tab] [Tab]

or conversely,

tail -f /var/log/apache/yoursite …[Tab][Tab]

Once you have the full command, with error at the end, Hit Enter. It should show you the most recent error messages. Again, if you want to trigger the error again (by doing whatever is causing the error, in another window), hit Enter a bunch of times to create some space so you’ll see the right thing as soon as it pops up.

Troubleshooting

 A few tips:

  • Unlike MS Windows, this land is case-sensitive. If you capped something that shouldn’t be, or vice versa, it’s not going to work. Using tab-complete will insure you have the right case.
  •  In the command-line, spaces matter. If you added one or took one out, your command will fail.
  •  If you want to run a command you already ran, hit the Up key to scroll to it.
  •  To copy something to paste it elsewhere, you need only select it. Selected text in Putty is copied automatically.
  •  To paste something into Putty, hold down both mouse keys at once.
  •  If your log isn’t at tail -f /var/log/httpd/yoursite or tail -f /var/log/apache/yoursite try reading your Apache configuration file.
  • If your server isn’t run on Apache, this probably won’t work for you.
  • Want to see both your log and any errors at the same time? Type this: tail -f /var/log/httpd/fyoursite_{error,log} …or whatever tab-complete has offered you, plus {error,log}.

Help! How Do I Get Out of This Thing?

If you want to get out without closing the window, press CTRL + C and it will take you out of the log and back to your command prompt.

I’ve tried to make this baby-simple for folks who aren’t generally comfortable on the command-line. I hope it helps!


How to Be Notified If Somebody Hacks Your WordPress Site

Monitor site for hacking

Last week, we covered two tools to help you scan your website for malware. Another method to determine if your site has been hacked is to look at changes in your server files themselves. That, though, can be time consuming if you do it manually. If you use WordPress (the self-hosted variety), and you want to use an automated tool that detects changes to files, take File Monitor Plus for a spin.

Read more


Two Free Tools to Scan Your Website for Vulnerabilities

40Tech clean

Yesterday we compared Squarespace and WordPress, and I indicated that as slick as Squarespace was, 40Tech was going to remain on a self-hosted WordPress installation. Bloggers using a self-hosted instance of WordPress, though, need to make sure that their blogs are secure. That includes making sure that your blog isn’t already compromised. How do you do that? The easiest way to do that is to use external tools to scan your site. There are two that we use here at 40Tech, and recommend.

Read more


WordPress Backup to the Cloud, Made Easy

updraft

Earlier this month, we took a look at 4 ways to backup your WordPress blog.  That post covered steps you could take to backup your site, including the use of WordPress plugins.  We’re always on the lookout for better ways to get things done, and when it comes to backing up a WordPress blog, we’ve found a gem.  Updraft is a dead simple plugin that will backup the contents of your site to the cloud (such as Amazon S3) or to an FTP server.  You can even have the backup emailed to you.

What makes Updraft so awesome is how simple it is.  When I set it up for 40Tech, it automatically set a backup directory on the server.  I only had to set the backup interval (daily, weekly, monthly, or manual), and fill in my Amazon S3 account details.  When I log into my S3 account, I can see the backup files sitting there.

You can set Updraft to email you when a backup is complete, and to delete the local backup on your server (prior to uploading the backup to the cloud, Updraft generates it in a folder on your server).  You can also specify how many backups to keep.  Perhaps the best part of Updraft is that your backup can be restored with the click of a button.

updraft backup

One word of warning: if you’re using Amazon S3, don’t use any non-alphanumeric characters in your bucket name.  When I first set up Updraft, the backups were sitting on the server, and not being transferred into S3.  I had been using a bucket that had an underscore in the name.  When I changed that to a simple name, the backups started working as intended.

Updraft is pretty awesome.  Have you found anything better?

Updraft [via MakeUseOf]


How W3 Total Cache Speeds Up Your WordPress Site (Plus the Novice’s Guide to Minify Settings)

W3 Total Cache

If you run a website, content may be king, but speed is the cook that keeps the king fed.  Recently, we talked about WhichLoadsFaster, a site that compares loading times of two or more websites.  How do you improve your site’s chances of being the site that loads faster?One of the best tools for speeding up sites, and one that we use here at 40Tech, is W3 Total Cache, a caching plugin.  W3 Total Cache not only speeds up your site, but it can also save you bandwidth.

First, though, let’s look at how WordPress works without a caching plugin.  Normally, when someone visits your site, WordPress has to build everything on the page.  It does that by processing code, making calls to your database, and outputting the final content that your visitors see in their browsers.  Caching strips down this process.  The general idea behind caching is that much of this process will (ideally) happen once – the first time someone visits the page.  The page is saved at the time of that visit, and the prebuilt version of the page is then displayed to subsequent visitors, for a predetermined period of time.

W3 Total Cache is one of the more advanced caching plugins, so it can be daunting.  There are several ways that it can cache your site (all of which we’re using here at 40Tech).  The caching options are Page Cache, Minfy, Database Cache, Object Cache, and Browser Cache.  You can also set up a CDN (Content Distribution Network).

Most of the settings don’t require any effort at all if you have a typical shared hosting solution.  I went with the default settings for almost all of the settings, and they worked without any trouble.  The two exceptions to this, and the two that are the most interesting from a geek perspective, are Minify, and the CDN options.

Using a CDN is a way to distribute some of your site images and other files on servers closer to your users.  This not only speeds up your site, but also saves you bandwidth.  40Tech uses Amazon’s S3 and Cloudfront, which has a global network and is so cheap it is almost free.  All that I had to do was input my Amazon S3 settings on the plugin’s CDN settings page, let the plugin walk me through getting the initial files uploaded, and I was good to go.

How I Set Up the Minify Features

W3 Total Cache’s Minify feature decreases the size and number of CSS and JS files by combining them into one file.  You have to configure this, though, which might make your head explode at first glance.

If you take your time and do it in steps, though, it isn’t so hard.  I did it by clicking on the Help Wizard button on the minify page, and just going through trial and error.  I checked the box next to a few scripts at a time, testing out the site to make sure that I didn’t break anything.  Fortunately, W3 Total Cache allows you to preview any changes before deploying them to the site (by clicking the “Preview” button near the top of the plugin settings page).  So, if a minfied item messed up the site, I tried it in a different location, and ultimately removed it from the minified settings if it just wouldn’t work.  It took time, and eventually I had identified each piece that could be minified.  This might not be the ideal way to do it, but for a novice, it works.  When you’re done, don’t forget to click the “Deploy” button to have the changes go live on your site.

Are you a site owner?  What ways have you found to be speed up your site?