Click to search Andy Jarrett.co.uk RSS feed

Loading Twitter

Apache server alias wildcard

Something I've learnt recently that I might be the last to know but you can use wildcards (*) in the ServerAlias in Apache. In the past I've done something along the lines of

view plain print about
1<VirtualHost *:80>
2    ServerName example.com
3    ServerAlias www.example.com www.example.co.uk example.co.uk
4</VirtualHost>

Really all you need to do is:

view plain print about
1<VirtualHost *:80>
2    ServerName example.com
3    ServerAlias *.example.*
4</VirtualHost>

Hope this helps someone else

Comments Comments (1) | Print Print | Send Send | 1119 Views

htaccess for moving domain names

Apache uses .htaccess files as a way to make configuration changes on a per-directory (and subdirectories) basis. They are a powerful tool when it comes to moving folders of changed files or in my case domain name rewriting.

Currently I am using a short domain name (prsos.co.uk) as a redirect to a specific page on the full domain name petrescuesos.co.uk. In the past I've even used ColdFusion to do by putting something along the lines in my Application.cfm.

view plain print about
1<cfif findNoCase('prsos', cgi.server_name)>
2<cfheader statustext="Moved permanently" statuscode="301" />
3<cfheader value="http://www.petrescuesos.co.uk" name="Location">
4</cfif>

This still gives the browser/spider the correct http header but why waste cpu styles on even doing this when the web-server can handle it natively. Below is the Apache .htaccess I've just put in place.

view plain print about
1#Turn rewrite on
2RewriteEngine on
3#Look at the HTTP_HOST and regex search for old domain name
4rewritecond %{http_host} ^(.*)prsos.co.uk [nc]
5# The rule. Change the http_host to the new domain location. NC means NoCase
6rewriterule ^(.*)$ http://www.petrescuesos.co.uk/index.cfm?action=pets.found [r=301,nc]

Comments Comments (0) | Print Print | Send Send | 784 Views

My blog has moved

Please update your bookmarks and feeds for my site.

I now have a Mango Blog at:

http://www.andyjarrett.com/blog

Feed URL: http://feeds.feedburner.com/andyjarrett

Comments Comments (0) | Print Print | Send Send | 1261 Views

Speed up Apche2 with mod_deflate

Before there was mod_gzip but now in Apache 2 there is mod_deflate. Its pretty much the same, and included with the default source package now. The syntax is pretty much the same. You can set it across the board or on a MIME type basis.

Check out the Apache docs for a proper understanding. Currently I am still testing my setup and on my Ubuntu installation I edited the following configuration to add some MIME Type rules

view plain print about
1$ sudo nano etc/apache2/mods-enabled/deflate.conf

The following rules I am using are

view plain print about
1<Location />
2AddOutputFilterByType DEFLATE text/plain
3AddOutputFilterByType DEFLATE text/xml
4AddOutputFilterByType DEFLATE application/xhtml+xml
5AddOutputFilterByType DEFLATE text/css
6AddOutputFilterByType DEFLATE application/xml
7AddOutputFilterByType DEFLATE application/rss+xml
8AddOutputFilterByType DEFLATE application/atom_xml
9AddOutputFilterByType DEFLATE application/x-javascript
10AddOutputFilterByType DEFLATE text/html
11<Location>

Do read the docs though, as not all browsers can handle this but there are ways to get around that.

Comments Comments (0) | Print Print | Send Send | 1234 Views

Setting up Apache and Subversion on JeOS (Ubuntu)

I'll be honest, I don't have much linux experience. I've always liked the idea of Linux and a command line driven OS but as soon as I see the GUI I tend point and click, which means I don't learn anything new. Then comes along JeOS (Just enough OS, pronounced as "juice") from Ubuntu which doesn't give you a GUI, it just gives you the bare minimum to run a server. It's designed for VM's and perfect for running a Subversion server on your local machine in the background. The specs are:

  • Less than 100Mb ISO image
  • Less than 300Mb installed footprint
  • Specialised -virtual Kernel 2.6.24
  • Optimised for VMWare ESX, VMWare Server and KVM
  • Intel or AMD x86 architecture
  • Minimum memory 128M
  • No graphical environment preloaded as it is aimed at server virtual appliance

So with JeOS and VMWare Fusion armed I was ready to setup a light-weight Subversion and Apache server. Below documents what I did to get a single SVN repository up and running. Im not installing Trac or SSL with this just so you know. I might try and cover them later, along with multiple repositories.

Setting up JeOS with VMWare fusion is no different than setting up any other VM so I won't go over that here. I'll assume that you can do that, and have done that and now at the command prompt.

Obviously because there is no GUI supplied all commands have to be run from the Command Line/Terminal. This also means editing txt files from the terminal too. If you've never used VIMM you might want to have the following URL handy www.gnulamp.com/vi.html

First things first, lets make sure your install is up-to-date.

view plain print about
1$ sudo apt-get update

[More]

Comments Comments (4) | Print Print | Send Send | 4840 Views

Building and installing Apache 2 on a Mac

Ok Below is a rough guide to get anyone up and going when it comes to building and installing Apache 2 from source. We're gonna do this all from the Terminal found in /Applications/Utilities/Termain.app.

Please note that '$' means new line, don't type this character If you want to know about any of the commands we make from the terminal you can always type "man + command" e.g.

view plain print about
1$ man curl
If you run the above code it should tell you that
curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.

This will also detail the options I use.

[More]

Comments Comments (7) | Print Print | Send Send | 4842 Views

Setting up and using windows HOST file

Host files used in windows to describe many-to-one mapping of device names to IP addresses. Using this file is helpful when developing locally as it allows you to assign the URL of the site to a local IP.

First, find you host file:
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts

The HOST file doesn't have an extention and can be opened with notepad.

** Before we go any further make sure you back this up - just in case ***

[More]

Comments Comments (0) | Print Print | Send Send | 12222 Views

Apache, CFMX 6.1, CFMX 7

Im currently running two seperate installs of CFMX, both 6.1 and 7 with apache as my local server. To do this ensure in your httpd.conf file you have the following

#######################

### FOR CFMX 6.1

#######################

#
# Bring in additional module-specific configurations
#
<IfModule mod_ssl.c>
Include conf/ssl.conf
</IfModule>
# JRun Settings
LoadModule jrun_module "C:/CFusionMX/runtime/lib/wsconfig/1/mod_jrun20.so"
<IfModule mod_jrun20.c>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ssl false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore "C:/CFusionMX/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51010
#JRunConfig Errorurl <optionally redirect to this URL on errors>
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc
</IfModule>
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so


#######################

### FOR CFMX 7

#######################

# JRun Settings
LoadModule jrun_module "C:/CFusionMX7/runtime/lib/wsconfig/1/mod_jrun20.so"
<IfModule mod_jrun20.c>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ssl false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore "C:/CFusionMX7/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51011
#JRunConfig Errorurl <optionally redirect to this URL on errors>
#JRunConfig ProxyRetryInterval 600
#JRunConfig ConnectTimeout 15
#JRunConfig RecvTimeout 300
#JRunConfig SendTimeout 15
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>

Also to make my life easier (though not as easy as i first thought it would but thats for another post) i'm using System Manager

Comments Comments (0) | Print Print | Send Send | 2998 Views

Open source Java by Apache

ZDnet is reporting that Apache is going to create, from scratch, an open source implementation of J2SE, and has Sun's approval to do so

The implementation which is (at the moment) welcomed by Sun, might even have Sun helping them out. Though don't get too excited analysts are expecting it to take 3-5 years

Comments Comments (0) | Print Print | Send Send | 1936 Views

Subversion on Apache Installation Tutorial for Windows (newbies)

A stright forward guide to the initial set up of Subversion (on Apache)

better-scm.berlios.de/subversion/Svn-Win32-Inst-Guide.html

Comments Comments (0) | Print Print | Send Send | 4882 Views

apache, with virtualhosts on multiple ports

Here mainly because i forget this. If you want to set up a new VirtualHost ,on your Apache Server,on new port i.e. 81 just add this to your HTTPD.conf file

<VirtualHost 127.0.0.1:81>
   ServerAdmin temp@temp.com
   DocumentRoot "c:/wwwroot/"
   ServerName www.newsiteport81.com
</VirtualHost>

but before you restart the services don't forget to make Apache Listen on that port as well by adding the following under "LISTEN 80"

# ADD PORT 81
Listen 81

Without this Apache will not be listening on PORT 81, and you'll be sitting in front of your box wondering what you've missed - you'll realise - then you'll blog about it ;o)

Comments Comments (0) | Print Print | Send Send | 4566 Views

CFMX 7, Apache 2 and DWMX Extensions

Still not posting much at the minute due to work. But i did get around to sticking CFMX 7 on my new Laptop. All went well - couldnt get the Admin page up but a simple restart of Apache and all went well.

Also you can download the CFMX 7 extensions for DWMX at Macromedia

Comments Comments (0) | Print Print | Send Send | 2037 Views

CFMX on IIS and Apache2 on the same machine

Well with a new machine in the works for my company i've been thinking about running Apahce (on windows) for our server. Anyway what with mappings etc i really wanted to give this a bash at home first. At first i thought this was gonna mean me, notepad and a bunch of text files had to get friendly. Actually its couldn't of been easier thanks to CF.

  • Download and install Apache. I needed to change the port to 81 so it didnt interfere with IIS which meant i changed the "Listen" port to 81 in the httpd.conf file
  • Edit C:\CFusionMX\bin\connectors\Apache_connector.bat to look at "apache2" folder instead of "Apache". Then run the bat file.
  • Restart Apache and all is well, easy.

Do remember though that they are using the same CF engine. If you have the enterprise version you could most likely set up a different instance for each web server, but i dont so i can't ;o(

Afterthought:If you want to administer CF from Apache then you will need to add the following to the ScriptAlias section of httpd.cong
Alias /CFIDE "%cfroot%/CFIDE/"
Alias /cfide "%cfroot%/CFIDE/"

Replacing "%cfroot%" for the director path to CFIDE folder i.e. c:/coldfusionmx/wwroot/

Comments Comments (0) | Print Print | Send Send | 2397 Views

BlogCFC by Raymond Camden + Twitter @AndyJ + ColdFusion jobs + Contact Me + Snippets/Downloads + RSS .