Entries Tagged as 'Windows 2008 Server'

Per application servlet mappings for Railo

Railo , Windows 2008 Server No Comments »

Another of the big annoyances with Railo is that it won't handle SEO friendly URL's out of the box, you need to get into the application servers servlet mappings to add url filters for each of your SEO URL formats.

e.g. each of these would require a separate servlet mappings url-filter.

mysite.com/index.cfm/something
mysite.com/sub1/index.cfm/something
mysite.com/muraCMS/index.cfm/something

If you are on a shared server then this can be a big problem as you do not have the ability to do this, plus making changes may also break other sites.

Thankfully there is a solution that allows you to apply these url filters on a per site basis, at least for Jetty anyway, I have not tested on any of the other servlet containers such as Tomcat, but the same solution is likely possible.

in your web root you will have a "web-inf" folder which is created automatically and contains your Railo context, inside this folder create a web.xml file and paste in the below contents. 
This will allow the most common SEO URL  "index.cfm/something" to work, I have also included the required filters for MangoBlog. Now you just need to modify this file within each of your sites and add any required url-filters.
The only caveat is that you need to restart your app server in order for the settings to take affect, if you are using the Helicon Zoo module that I blogged about previously then you simply need to recycle your application pool. This can be achieved by editing your web.config as any change to this file forces IIS to recycle the application pool.

 

<?xml version="1.0" encoding="ISO-8859-1"?>
 
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true"
version="2.5"
>
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>index.cfm/*</url-pattern>
<url-pattern>/post.cfm/*</url-pattern>
<url-pattern>/archives.cfm/*</url-pattern>
<url-pattern>/page.cfm/*</url-pattern>
<url-pattern>/author.cfm/*</url-pattern>
<url-pattern>/feeds.cfm/*</url-pattern>
</servlet-mapping>
</web-app>

 

 

Plugin updates fail on wordpress and other PHP apps resulting in locked files.

WEBBY STUFF , Windows 2008 Server No Comments »

If you are running windows 2008 server with IIS 7 then you may have noticed a problem with your PHP apps such as Wordpress or Joomla when you try to perform updates.

The problem occurs when the old files are deleted, the delete fails to complete leaving the files/folders in a locked state and you are then unable to do anything with them at all.

this problem has been plaguing me fore a few months and solution has been to use a file unlocker tool to release the lock.

I have recently found the cause for this to be the Wincache extension for PHP, you can find more details and a fix HERE.

The WebResource.axd handler must be registered in the configuration to process this request

ColdFusion , Windows 2008 Server No Comments »

Has this crop up a few times, and there are all kinds of articles on the web giving complex workarounds which simply did not apply in my case.

The cause in my case was ColdFusion, specifically the wildcard (*)  handler mapping, because this handler tries to process the request first to see if the file being requested is CFML, if not then it returns the request back to IIS, which thus causes the above error.

The solution is simply to remove the wildcard handler mapping.

image

If you need to run CF and ASP.NET on the same site then you need to do so without the wildcard handler mapping. Unfortunately the regular handlers don't actually work as they point to jrun_iis6.dll , and I have no idea why they are even created, perhaps some legacy thing.

So you have to  change all the standard handlers (.cfm, .jsp etc) to point to the jrun_iis6_wildcard.dll instead of jrun_iis6.dll, and CFM pages will now work happily with ASP, PHP or anything else.

IIS7 blocks viewing access to certain folder names

WEBBY STUFF , Windows 2008 Server No Comments »

I was just asked to help someone troubleshoot a site that worked fine on previous host but didn't work on Windows Server 2008 / IIS7.  None of the images on certain pages were displaying,  the image path looked something like this:

 

http://www.sitename.com/subfolder/bin/file.jpg

 

The subfolder wasn't marked as an application, although that doesn't really matter.  The point is that since /bin/ was in the path somewhere, and it turns out that  IIS7 wont allow any file to be displayed with a /bin/ in the path.  It serves up a 404.2 error saying file or directory not found.

 

404 - File or directory not found.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.If you look

 

If you look in applicationHost.config you will find the following under the <requestFiltering> section:

 

 
<hiddenSegments applyToWebDAV="true">
 <add segment="web.config" />
 <add segment="bin" />
 <add segment="App_code" />
 <add segment="App_GlobalResources" />
 <add segment="App_LocalResources" />
 <add segment="App_WebReferences" />
 <add segment="App_Data" />
 <add segment="App_Browsers" />
</hiddenSegments>

 

So, IIS7 now blocks those key folders and doesn't allow them to be seen.  To the outside world, any page in any of these folders appears to not exist.

 

The easy solution is to change the folder name, but there may be times when you really do want to keep the path name, such as for SEO purposes.  Not to worry, it can be changed easily enough.  This setting in on purpose though as it is for asp.net, so you usually shouldn't remove it for the whole site.

 

If it is your own server then you can use AppCmd or do it manually from applicationHost.config or web.config.  Since requestFiltering is allowed to be set at the site or folder level by default, it's probably best to set a web.config file in the folder that you want to allow, which is your only option on shared hosting.

 

To do this on a per folder level, create a web.config file in your folder and type or paste the following into it.  It should look something like this:

 

<?xml version="1.0"?>
 <configuration>
 <system.webServer>
 <security>
 <requestFiltering>
 <hiddenSegments>
 <remove segment="bin" />
 </hiddenSegments>
 </requestFiltering>
 </security>
 </system.webServer>
</configuration>

If you want to make the change to your applicationHost.config file instead, you can do it by adding a location tag to the bottom of the file (well, almost the bottom - along with the other location tags) like this:

 

<location path="sitename.com/subfolder/bin/debug">
 <system.webServer>
 <security>
 <requestFiltering>
 <hiddenSegments>
 <remove segment="bin" />
 </hiddenSegments>
 </requestFiltering>
 </security>
 </system.webServer>
</location>

 

 

To do this using AppCmd just drop to the command prompt and type the following: (Be sure to change the paths to the correct page before running this.)

 

C:\Windows\System32\inetsrv\appcmd.exe set config "sitename.com/subfolder/bin/debug" -section:system.webServer/security/requestFiltering /-hiddenSegments.[segment='bin']

 

After making this change, you will be able to view pages normally, even if they have /bin in the site path.

ZendPHPviaFastCGI Gives 500 Internal Server Error

WEBBY STUFF , Windows 2008 Server 2 Comments »

Been having a fun time today trying to get Magento CMS working. The bizarre situation was that PHP would work fine under the default web site, but not under any other web site, which would result in a 500 Internal Server Error caused by the ZendPHPviaFastCGI PHP handler mapping. See screenshot below. I of course tried every possible solution without success, the cause turned out to be rather obscure.

 

fastcgi error

 

 

What was required to fix this was to manually add this attribute to the handler mapping in the applicationHost.config file, which you will find in C:\Windows\System32\inetsrv\config.

 

allowPathInfo="true"

 

PathInfo refers to the additional path information that may follow the file name and extension in a Uniform Resource Identifier (URI). For example, if you request the URI http://localhost/test.dll/myinfo, the PathInfo portion of that URI is /myinfo

This parameter does not seem to exist in the IIS Manager and is not even mentioned in the handler docs so I really do really not know why this is required or why it is not there by default and why you cannot add it via the GUI.

 

So the final entry for my ZendPHPviaFastCGI handler looked like this.

 

<add name="ZendPHPviaFastCGI" path="*.php" verb="*" modules="FastCgiModule"

scriptProcessor="C:\Program Files (x86)\Zend\ZendServer\bin\php-cgi.exe"

resourceType="Either" requireAccess="Script" allowPathInfo="true" />

 

Credit must go to my buddy Matt Gahan for working this one out.

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds