@Steve, I would second Charlie's comment regarding troubleshooting
your particular environment -- the more information you can supply
regarding your specific setup and what you attempted to do, the more
likely that someone can help you to get it working.

That said, if you want an example of how you can set up an MG site
with as little as possible in the webroot, give this a shot:

1. Create a new MG site from the application template, placing it
within the default webroot of your web server so you can browse to it
at http://{server name}/{site name}/ -- for example, I named my test
site "MG3Test", and can hit it at http://localhost/MG3Test/

2. Create a "webroot" directory directly under the site directory.

3. Move the "css" directory and the following files into the "webroot"
directory:

Application.cfc
index.cfm
RemotingService.cfc

4. Delete the remaining "loose" files at the root level of the site.
At this point, your top-level directory structure should look like
this:

config
controller
helpers
model
views
webroot

5. In webroot/index.cfm, uncomment the following line (line 17 in my
copy of the app template):

<cfset ModelGlue_LOCAL_COLDSPRING_PATH = expandPath(".") &
"/config/ColdSpring.xml" />

and change it to:

<cfset ModelGlue_LOCAL_COLDSPRING_PATH = expandPath("..") &
"/config/ColdSpring.xml" />

(The argument to the expandPath function changes from "." to "..")

6. In config/ColdSpring.xml, make the following two alterations:

Change this (line 24):

<property 
name="configurationPath"><value>config/ModelGlue.xml</value></property>

to this:

<property 
name="configurationPath"><value>../config/ModelGlue.xml</value></property>

and this (line 41):

<property 
name="scaffoldPath"><value>config/scaffolds/Scaffolds.xml</value></property>

to this:

<property 
name="scaffoldPath"><value>../config/scaffolds/Scaffolds.xml</value></property>

7. If you're going to be using remoting, change the following line in
webroot/RemotingService.cfc (line 6) from this:

<cfset template = "/{site name}/index.cfm" />

to this:

<cfset template = "/{site name}/webroot/index.cfm" />

(For my site, this would be: <cfset template = "/MG3Test/webroot/index.cfm" />)

At this point, you should be able to browse the site at http://{server
name}/{site name}/webroot/ -- for example, my URL is now
http://localhost/MG3Test/webroot/ -- and the config files,
controllers, views, etc. are all above the webroot directory.

You can then define a virtual host/site on your web server that points
to the {site name}/webroot directory. In order to avoid the need to
make any further changes to the CS config and file paths, you will
need a mapping for the site's root directory.

If you're on CF 8+ you can set up an application-specific mapping by
adding a line like this to the pseudo-constructor area of your
Application.cfc (in other words, outside of any functions):

<cfset this.mappings["/MG3Test"] = expandPath("..") />

And as a final note, when deploying something like this in production
make sure that you *do not* place the site under your web server's
default webroot (if enabled), or the config files will still be web
accessible at a URL like: http://{server IP}/{site
name}/config/ColdSpring.xml

Please let me know if you have any further questions about this technique.

--
Ezra Parker


On Thu, Nov 5, 2009 at 5:58 AM, steve82 <[email protected]> wrote:
>
> Hi all,
>
> I like your idea of simply adding the .cfm file extension to prevent
> my config files from being displayed in the clients browser. Sounds
> good to mee, I will definitely give it a try as soon as possible.
> Nevertheless, how would one accomplish the same goal by moving the
> config files out of the web root and creating a mapping to this new
> place. I'm just curious to know ;o)
>
> Thank you very much for your help so far.
>
> Steve
>
> On 5 Nov., 11:21, Doug Boude <[email protected]> wrote:
>> One quick easy solution is to simply add the ".cfm" extension to your xml
>> files (as in, coldspring.xml.cfm) . CF can still use and access the files
>> just fine (make sure you modify the relevant paths where the xml files are
>> referred to), but when you attempt to get at them directly in a browser you
>> can't see their contents. All the cool kids are doing it. :)
>>
>> On Wed, Nov 4, 2009 at 3:42 AM, steve82 <[email protected]>wrote:
>>
>>
>>
>> > Hi,
>>
>> > i am new to the model-glue framework but i already find it very cool.
>> > One question that came in my mind: How can one prevent a user from
>> > accessing my Coldspring.xml and ModelGlue.xml files by simply typing
>> >www.pathtomyapp/config/ModelGlue.xmlin his browser. I don't want them
>> > to able to read all this configuration infos. I read some other posts
>> > here that said one could move the entire application out of the web
>> > root folder and create a mapping to that place. But how would one do
>> > that exactly? That suggestion sounds nice to me but i wasn't able to
>> > get it up and running.
>>
>> > Many thanks for your help and thoughts on this issue.
>>
>> > Steve
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to