Programming + Design

Multiple SSL Vhosts under a single IP address with Apache2 on Fedora Core 6
Written by Brett Brewer   
Tuesday, 26 August 2008

If you've ever seen the following warning when starting Apache, you no doubt had trouble figuring out the proper fix:

 _default_ VirtualHost overlap on port 443, the first has precedence

If you're anything like me, you probably diligently followed the Apache documentation and ended up creating multiple IP addresses simply to serve multiple web sites via SSL. Well, contrary to popular opinion and the official Apache docs (which are confusing or misleading on this topic), you CAN in fact use name-based hosting with SSL. You probably already have your main httpd.conf file set up properly, but need to tweak your SSL configuration. The problem is this: you are trying to use name based virtual hosting, but failed to specify name based vhosts for your SSL config. Basically, you need to add the following line somewhere immediately BEFORE the first vhost entry in you SSL config:

NameVirtualHost *:443

On Fedora Core 6 running Apache 2 you will find your config files in the following locations:



Basically, Apache2 on Fedora Core 6 puts all your non-standard config options in the "conf.d" subfolder so they are easier to organize...which I happen to love compared to the old way of cramming everything into the httpd.conf file. Anyway, if you are using named based hosting, you should have the following line somewhere in your httpd.conf file before the applicable vhost entries:

NameVirtualHost *:80

This will work if you are just using wildcards for the IP addresses for all your vhosts, otherwise make sure you have the specific ip address specified. Basically the "NameVirtualHost" address must exactly match the address specified in the individual vhost entries and it must come before them.

The trick to getting SSL working with multiple vhosts it to open your /etc/httpd/conf.d/ssl.conf file and find the opening tag of the default vhost entry. Before it just add the same NameVirtualHost you have in your main httpd.conf file, but change the port to your SSL port, which is usually 443:

 NameVirtualHost *:443

Be sure to put this directive BEFORE the first <virtualHost> container tag in your ssl.conf file or you will get errors. Also, if your ssl host entry looks like this:

<VirtualHost __default__:443>

you might want to change it to this

<VirtualHost *:443>

but only if the __default__:443 doesn't work. I don't know if it matters, but I've got mine set up with * instead of __default__. 

 Once you've added the NameVirtualHost directive you should be able to add <virtualHost> entries on port 443 to your ssl.conf file that correspond to the entries in your httpd.conf file and then your sites will work over both http and https and Apache will stop complaining about the hosts overlapping. Well, maybe not completely...I was scanning my apache logs and noticed some continued complaining by Apache, but the erros don't show up when starting Apache and the sites all seem to work, so YAY! I don't know why this isn't listed somewhere in the Apache docs because it seems like everyone setting up their own testing/development server eventually runs into this problem. Perhaps it's not the best way to do it for a live site, but it seems to work fine in my local test environment. I hope this info saves you the hours it took me to figure out. 

Last Updated ( Thursday, 28 August 2008 )
Using the PHP DBG extension with Ioncube Loader
Written by Brett Brewer   
Friday, 08 August 2008

If you just want to know how to load the DBG module with IONCUBE loader, skip to the bottom of this post. 

I hate encoded PHP files. I mean I REEEEEEAAAAALY hate them. Not only does it make it infinitely harder to modify an application that relies on obfuscated PHP files, but it also tends to make it impossible to debug the non-encoded parts of your site, so you end up having to do ridiculous things like diabling all your encoded scripts so you can run a debugger on your own files. What a tragedy for PHP programmers everywhere who have to deal with this BS! Every time I do a project that requires me to work around encoded PHP files, it literally adds hours upon hours to the development much so that I could often have rewritten the encoded funtionality myself from scratch faster than I can code around it (I will actually probably start releasing my own free drop-in replacements for some very popular x-cart mods soon if I can't get the authors to release the source).  My advice as a PHP developer is, steer clear of encoded files whenever possible. If you must use them, put pressure on the developers to release unencoded versions, possibly for an additional fee, or ask them to at least document all the internal functions so you know what the heck is happening inside scripts that your own scripts will need to coexist and sometimes interact with.

Firebug 1.2 beta released
Written by Brett Brewer   
Wednesday, 25 June 2008
I've been loving the new Firefox 3.0 release, but missing the hell out of Firebug for Javascript debugging. The seemingly offical firebug web site is a bit out of date. The 1.1 beta version download on their homepage doesn't work and they don't list the newest 1.2 beta release for Firefox 3.0. After a brief search I stumbled across the Firebug 1.2.0b3 release which is the current recommended version for use with Firefox 3.
Last Updated ( Wednesday, 25 June 2008 )
Admin operating as a user in X-Cart
Written by Brett Brewer   
Wednesday, 28 May 2008

Sometimes in X-Cart you may want to view something as a specific customer would view it. To temporarily access customer pages as a particular user you need only to be logged in as the admin and then pass the variable $HTTP_GET_VARS['operate_as_user'] to the customer page you are trying to view. So you would just add something like this to the querystring of your requested URL....


or if you're trying to be all nice and XHTML compliant you'd use:


Not an earthshattering bit of info, but useful to know nontheless.  

FedEx Package Type for International Addresses in X-Cart
Written by Brett Brewer   
Tuesday, 27 May 2008
I just completed a simple mod for X-Cart 4.1.9 that will let you specify a different default FedEx package type for international addresses in X-Cart. Normally, when using the FedEx Direct integration method with X-Cart you can only specify a package type for FedEx Express and FedEx Ground service. I ran into a situation with a client who needed to specify FedEx ExpressPak as the package type only for international addresses, so I whipped up this simple mod which you might find helpful...
Last Updated ( Wednesday, 24 September 2008 )
Why Javascript Arrays Suck
Written by Brett Brewer   
Thursday, 24 April 2008
I've been writing a new AJAX based POS system for a client and lamenting the horrible state of javascript array manipulation which has consumed the bulk of my time. It seems that there is a major problem with trying to iterate over arrays with arbitrary numerical indexes. The problem is, there's no good way to iterate over a javascript array to achieve a typical "foreach" type of loop such as what you would commonly do in PHP. One of the best uses for this is to gain access to the name or number of the index for the array element you are currently iterating over so you can use the array index in some kind of programming logic. To achieve this same functionality in Javascrtip, most people use ( loops to "enumerate" the properties of an array. This works if you have created a "sparse array" that contains only numeric indexes, but the problem is that Javascript library creators (Scriptaculous, Prototype, and many others) modify the Array prototype at runtime and add all sorts of properties that get added to your array and end up being enumerated in your loop. This tends to break the hell out of legacy javascript code that relies on to loop over an array. Not cool. Javascript gurus will tell you this is normal behavior and that's what a loop is for, but lazy programmers like me will tell you this sucks because it makes something that should be extremely simple, extremely difficult. Anyway, this article on DHTML Kitchen explains it better than I do. If you're trying to iterate over a Javascript array like you do your PHP arrays, read the article to see why your life is such hell.
Last Updated ( Thursday, 24 April 2008 )
Fixing .NET framework problems when all else fails
Written by Brett Brewer   
Wednesday, 09 April 2008
Microsoft products are quickly becoming famous for showstopping update problems. I just spent 4 hours trying to fix a .NET problem caused by a failed .NET update, which was in turn caused by a Quickbooks update. It's hard to put either company at the top of my "most hated" list when they both really deserve to share the #1 spot. It's also very hard to believe that massive software installation problems with .NET can sometimes only be fixed by downloading a 3rd party program to do a REAL uninstall of all traces of .NET so you can perform a clean reinstall. Microsoft certainly does nothing to make this an easy task. Fortunately for everyone, there IS such a tool from someone name Aaron Stebner. Check out Aaron Stebner's .NET removal tool which quickly and easily removes ALL traces of ALL versions of the .NET frameworks. Mad props to Aaron Stebner for this incredibly necessary tool!
Last Updated ( Wednesday, 09 April 2008 )
Spicebird: How I Learned to Stop Worrying About MS Outlook and Uninstalled Office
Written by Brett Brewer   
Tuesday, 08 April 2008
I did something recently that I'm quite proud of. One day a few months ago, MS Word suddenly started refusing to open or save documents, complaining constantly about not being able to write to my Temp directory. After a couple of weekends of fruitless troubleshooting, the problem had spead to MS Outlook, making the situation critical. I was so fed up with trying to troubleshoot my MS Office installation that I finally just uninstalled it all and installed as my general MSOffice replacement and Mozilla Spicebird as an Outlook replacement. I'd been casually using for a couple of years, so it was no surprise to me that it could easily replace most of my MS Office apps, especially since I don't generally care about using or maintaining any custom formatting in my Word or PowerPoint docs. Spicebird however, has turned out to be a pleasant surprise.
Last Updated ( Wednesday, 09 April 2008 )
<< Start < Prev 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 41 - 48 of 85


Who's Online

© 2017
Joomla! is Free Software released under the GNU/GPL License.