Using FQDN on local intranet with CakePHP application


This is my first question in this community so please forgive any mistakes and break in protocol.

I have a CakePHP application running from my www directory on my LAMP server. I need help on how to move and serve the application from a directory outside the server www directory in the most secure way. Also the the CakePHP application is running on address and this ip is always used to access the app. Now I have registered a domain name e.g and I want this to be used to access the app. Most importantly I want to disable all access to server application via ip address.

My server runs on Ubuntu 12.04 server.

Thank you.
Who is Participating?
Chris StanyonConnect With a Mentor Commented:
I don't use Ubuntu or CakePHP but this general principle may still apply.

In Apache, you will have the ability to enable Virtual Hosts. Not sure of the specifics for your installation, but on Windows, you un-comment the following line:

Include conf/extra/httpd-vhosts.conf

Open in new window

Now you can create virtual hosts by editing this file and adding an entry along these lines:

<virtualhost *:80>
	DocumentRoot "C:/yourWebServer/someDomainFolder/public_html/"
	<Directory "/">
		AllowOverride All
		Order allow,deny
		Allow from all

Open in new window

You can serve the files in that folder by pointing your browser to

You will also need to add an entry to your local DNS server which maps the IP address to your server to the domain name. Again, not sure on the details for Ubuntu, but in Windows you simply add an entry into a HOSTS file:

I know it's not specific to your installation, but as I say - the general principle will be the same
Duncan RoeSoftware DeveloperCommented:
People from outside can't directly access (if that's one of the questions you were asking). So your application can stay there and only your server can talk to it (and others on your local LAN can too, but I guess that's OK with you).
moh_oracleAuthor Commented:
Thank you for your response. I am trying to protect it from my local LAN too, the server is available over multiple VPN sites. Hence the added security to keep the application outside the www directory.

Thank you.
Duncan RoeSoftware DeveloperCommented:
Sorry but that is outside of my experience. I've asked a Moderator to expose this Question to some other Experts - it came to me as a Neglected Question Alert.
moh_oracleAuthor Commented:
Thank you,

Your solution works after configuring to fit my situation.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.