Tag Archives: linux

Redirect all traffic to https

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Similar Posts:

Tagged , , ,

WordPress + SVN + Auto-update

I’ve been using the latest cutting edge wordpress from svn for a while now and it’s been good. At the time of the writing

You are using WordPress 3.0-alpha.

Basically, even the latest code is safe(ish) and things don’t break easily.

I’m not using it for “production” per se, as the only other person who ever reads this blog is probably me!

So, here’s how I do it:

svn up

If you expected more, there’s really not much there. As everything is pretty simple to setup as per the notes in http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion

Some would only want to update to “stable” version. Others, like me will follow the absolute latest.

Now, how about the permissions for the directory where wordpress is setup. Here’s what I use:

my username: wpuser

apache user: nobody

wordpress installation directory: /home/wpuser/public_html/

cd /home/wpuser/public_html

chown -R wpuser:nobody

find . -type d -exec chmod 755 {} \;

find . -type f -exec chmod 644 {} \;

With the above, it’s easy to upgrade simply by going:

su wpuser

svn up

Now, the automatic upgrade/setup for plugins should work perfectly from within wordpress’ admin interface. If it doesn’t you might want to add the following in wp-config.php:

// Additional variables to allow auto update

define('FS_CHMOD_FILE',0644);

define('FS_CHMOD_DIR',0755);

define('FS_METHOD', 'direct');

I hope this helps someone out there. Give me a shout if it does 😉

Similar Posts:

Tagged , , , ,

AWStats for one or more domains

The documentation is per http://awstats.sourceforge.net/docs/awstats_setup.html

Here’s quick HOWTO, where I assume you have installed awstats using apt-get or rpm:
Copy the file /etc/awstats/awstats-dist.conf to /etc/awstats/awstats.mydomain.com.conf and changed the domain name there to fit the new site.

Then run the following command:
[root@funinc ~]# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=mydomain.com -update
(you may need to find the awstats.pl script, on debian /usr/lib/cgi-bin/awstats.pl)

Awstats creates a new set of files for the new site in its database.

Added the following line to your crontab file:
12 00 * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mydomain.com

basically this will tell awstats to generate a new set of reports for the mydomain.com site daily (at 12 noon!)

That’s it, go to http://mydomain.com/awstats/awstats.pl?config=mydomain.com

The apache configuration for debian:

Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /awstats/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch

Similar Posts:

Tagged ,

Apt-get update hangs on RHEL

If you’re using apt to manage your software installations on a redhat based machine, especially to make use of the rpmforge repository and tools, you might get this error.

Description:

I start apt-get update.  After a while, it gets to the apt.sw.be and hangs at a certain %. You cannot stop it as it hogs the CPU. (hint. login using console and kill it?)

The problem seems to be related to the /etc/apt/sources.list.d/rpmforge.list file. Simply comment out the repomd line and let it use the rpm line as follows:
rpm http://apt.sw.be redhat/el$(VERSION)/en/$(ARCH) dag
#repomd http://apt.sw.be redhat/el$(VERSION)/en/$(ARCH)/dag

This seems to affect rhel4/fedora servers.

Similar Posts:

Tagged ,

Install/Update Webmin

I’ve always liked one-liners. Here’s one (almost) for installing the latest webmin on almost any linux out there!

#!/bin/bash
EXT=".rpm"
PMAN="rpm -U"
if [ -e /etc/debian_version ]; then
EXT=".deb"; PMAN="dpkg -i"
fi
wget http://webmin.com -O - | grep $EXT | grep -o 'http://[^"]*' | xargs wget -O webmin_latest$EXT; $PMAN webmin_latest$EXT

[ad#ad-1]

You could copy and past the above in a terminal session, or the following:
wget http://mt.trickos.com/dev/installwebmin.sh; sh installwebmin.sh

Similar Posts:

Tagged ,