Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Tuesday, September 13, 2011

Useful Linux Commands

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 <content> with your own command/name).

Create a short name or alias to run a command.
alias <aliasname>='<somecommand>'

Create a symbolic link to another directory/file
ln -s <source> <target>
http://kb.iu.edu/data/abbe.html

Transfer files from your computer to a server or from a server to another server.
scp <somefile> <username@foobar.com>:</somefileordir>
scp <username@foobar.com>: <username2@foobar2.com>:</somefileordir>

Change file owner w/ recursion
chown -R <user>:<group>

Change file permissions for web w/ recursion
chmod -R 644 <somefileordir>

Find a file
find / -name <foo>
http://content.hccfl.edu/pollock/unix/findcmd.htm

Add a user
sudo useradd -d /home/<testuser> -m <testuser>
sudo passwd <testuser>

Change a users' primary group
usermod -g <newgroup> <user>

Add a group
groupadd <newgroup>

Add a user to a group
usermod -G <newgroup> <user>

Monday, September 12, 2011

client denied by server configuration

If you are getting this message either on the page or in the apache error logs, it is likely caused by the default apache configuration.  The default configuration does not allow the .htaccess to override settings.  You can fix this by editing either the httpd.conf or a conf-specific to a directory that is included in the httpd.conf:

Default:


    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all


Changed:


    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all

Monday, June 27, 2011

Apache Rewrite Rule

I'm not expert at Apache or Rewrite rules so this may be useless.  But to redirect any url except a certain folder you can use the following:


RewriteEngine on
RewriteCond %{REQUEST_URI} !test/ [NC]
RewriteCond %{REQUEST_URI} !blog\.iphoneidiot\.com$ [NC]
RewriteRule .* http://blog.iphoneidiot.com [R=302,L]

This redirects any request except the "test" folder to blog.iphoneidiot.com