Question

I have got myself a server, and on it I'd like to host my portfolio. My portfolio will be built using a tiny PHP MVC framework I wrote myself. This will be accessed by going to domain.com (for instance).

Now, on my portfolio, I want to host all of the other pieces of work I do. These will also be PHP MVCs. So, for example, domain.com/app1, domain.com/app2 and so on. However, as you probably know, the nature of a PHP MVC means that some files are not meant not be in the DocumentRoot (talking about Apache here). So, if you wanted to store all of your work like this, how would you go about achieving it?

An example directory structure of one of my apps:

/application
    /views
    /models
    /controllers
/public
    /js
    /css

Therefore domain.com/css should point to that apps css folder which is in the public folder, as should domain.com/app1/css point to its css folder in its public folder.

I'm just trying to work out a good way of organising my work. I would really appreciate anyones thoughts!

Was it helpful?

Solution

I would suggest that you use an apache alias for each new application : http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias

You will keep only one Virtual Host :

<VirtualHost *:80>
ServerName domain.com

Alias /app1/ /var/www/app1/public/
Alias /app2/ /var/www/app2/public/

</VirtualHost>

OTHER TIPS

Well

I would have my folders something like this:

/lib (main portfolio lib)
  /projects
    /project1 (main lib for project 1)

/public_html (main portfolio public root)
  /projects
    /project1 (main public root for project 1)

The only thing here is that for project 1, you'd have to set the lib folder to

../../../lib/projects/project1

as opposed to it's standalone

../lib

I hope that helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top