• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

Server Stuff

WordPress .htaccess Exclude folder from RewriteRule

December 8, 2011 by Webhead

To exclude a folder from the wordpress rewrite in .htaccess, add the following line before the other RewriteConds, replacing somedir with your folder name:

RewriteCond %{REQUEST_URI} !^/(somedir|somedir/.*)$

Filed Under: Server Stuff Tagged With: htaccess, wordpress

Useful Linux Commands

September 16, 2011 by Webhead

I recently had to move a server and needed to set up another server. I’m a linux newbie so I needed to look up a lot of things. Below are some of the more common commands that I needed: (replace with your own command/name).

Create a short name or alias to run a command.

alias =''

 

Create a symbolic link to another directory/file

ln -s  

http://kb.iu.edu/data/abbe.html

 

Transfer files from your computer to a server

scp  :

 

Transfer files from a server to another server.

scp : :

 

Change file owner w/ recursion

chown -R :

 

Change file permissions for web w/ recursion

chmod -R 644 

 

Find a file

find / -name 

http://content.hccfl.edu/pollock/unix/findcmd.htm

 

Add a user

sudo useradd -d /home/ -m 
sudo passwd 

 

Change a users’ primary group

usermod -g  

 

Add a group

groupadd 

 

Add a user to a group

usermod -G  

 

Make everything in a dir owned by the dir group owner

sudo chmod g+s 

Filed Under: Server Stuff Tagged With: apache, linux

Mac OS X Linux Stuff

September 15, 2011 by Webhead

Locations and commands on the Mac OS X vs any other Linux/Unix system are different.  Below are some of the locations and commands I ran across in setting up my macbook as a webserver.

apache2 is located in

/etc/apache2/

Along with the httpd.conf:

/etc/apache2/httpd.conf

By default apache2 logs are located at:

/var/log/apache2

By default files in the root directory are at:

/Library/WebServer/Documents/

To restart apache:

sudo /usr/sbin/apachectl restart

or

sudo apachectl -k restart

To Enable PHP, in httpd.conf remove the ‘#’ from this line:

#LoadModule php5_module        libexec/apache2/libphp5.so

Filed Under: Server Stuff Tagged With: apache, linux, mac os x, php

MySQL Auto Backup

August 4, 2011 by Webhead

The following commands should be run daily.  This will give you a backup for 1 full month.  After 1 month the backups will overwrite the oldest files.  The %d is the day of the month.

GoDaddy:

In your Hosting Dashboard -> Content -> Chron Manager, enter the following line as the command.  Replace <xxx> with the appropriate values.

mysqldump --opt -Q -h <server_address> --user=<username> --password=<password> <database_name> > <your_path>/<database_name>_`date +%d`.sql

BlueHost:

In the CPanel -> Cron Jobs, enter the following line as the command.  replace <xxx> with the appropriate values.

mysqldump --opt -Q -h localhost --user=<username> --password=<password> <database_name> > /<your_path>/<database_name>_`date +%d`.sql

Filed Under: Server Stuff Tagged With: bluehost, goDaddy, mysql

GoDaddy Password Protect Home Directory

August 2, 2011 by Webhead

Problem:

GoDaddy makes it simple to password protect a directory.  You just go to their file manager, click on a directory, click on Permissions, fill out a user and password and you’re done.  Bad thing is that you can’t password protect anything in the public root folder.

 

Solution:

Easiest solution is to password protect a subdirectory, open .htaccess, copy the code there and paste it into  your .htaccess in the root public folder and then wait a few hours.  Seriously, just wait.  I followed these steps and didn’t wait, got worried it wasn’t working and undid everything.  a few hours later I ran into this post:  http://www.besthostratings.com/articles/http-auth-php-cgi.html

With that post I felt that I could hackily get the authenticated username and password and then use PHP to determine whether the username/password is correct or not.  Then I could show or not show what I needed.  After all, this was only temporary until the client’s site went live.  I soon found out however that the first solution worked this time.  Go figure.

 

 

 

 

Filed Under: Server Stuff Tagged With: apache, goDaddy, hosting, htaccess

Setting up a Cron Job on GoDaddy

July 20, 2011 by Webhead

Set up GoDaddy Cron Job

  1. Log Into your GoDaddy.com account.
  2. Choose “My Hosting Account” from the “Hosting & Servers” menu on the top navigation bar.
  3. In the Hosting Account list, click the Open link beside the account you want to use for your website.
  4. In the Hosting Manager window, click the Cron Manager icon or “Cron Manager” menu item under content menu.
  5. Now you are on the page where you need to setup two cron jobs: one to run daily for the daily backups and one to run monthly for the monthly backups. The monthly one can run on any date of the month, just as long as the time it runs at is after the daily backup run.
  6. You need to know the following:
  7. Host Name: (Usually localhost but in case of godaddy account it will be look like mysql123.secureserver.net)
  8. Database Name: Name of the your database.
  9. User Name: User name of the database. In case of godaddy account it will be same as db name.
  10. DB Password: Database user password for authentication.
  11. Use the various drop downs to schedule your Cron job and enter the Cron Command Line you have created.
The command line should be something like:
mysqldump –opt -Q -h (hostname) –user=(user-name) –password=(password) (database-name) > (full path of backup file)
For example  if you did daily backups and wanted to keep one month’s worth (after 1 month it would be overwritten):
mysqldump –opt -Q -h some.thing.com –user=mywebdb –password=thePassword mywebdb > /home/content/b/a/b/babychep/html/backups/bak_`date +%d`.sql

Filed Under: Server Stuff Tagged With: linux

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to page 5
  • Go to Next Page »

Primary Sidebar

Topics

apache apple block editor chrome cms css debug eCommerce embed firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery linux localization mac os x ms sql mysql open source optimize php php 5.3 responsive rest api seo svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools