Jump to content
xisto Community
Sign in to follow this  
cityzen

Optimize Your Virtual Hosts: Separate Your Files From The Wamp

Recommended Posts

In the prior topic we saw how to install a WAMP and customize it to easily switch between virtual and real hosts typing the same address in the browser: ‘yoursite.com’.

Now, we’ll separate the Virtual Host’s files from the WAMP program to make virtual management easier. To see the prior tutorial, follow this link (if you have any issue, please live a comment):

3 Steps To Create And Manage Virtual Hosts To Test And Combine Offline And Online

 

Explanation

 

To store the programs we used the folder:

C:\Program Files\EasyPHP-12.1\

 

And the virtual hosts are physically located in:

C:\Program Files\EasyPHP-12.1\www\

 

As it doesn’t make many sense to store Virtual Host’s files within the programs, we’ll bring them here:

Z:\home\yoursite\public_html\yoursite.com\

 

Note: If you don’t have a ‘Z:/’ partition, you can easily create one using a partition editor like MagicPartition or Easeus, or whatever program you prefer. Of course, you can also choose an another location for your files ...

 

We’ll create this folders assuming that you use xisto's services and that your top-level directory in your real web hosting is:

/home/yoursite/

 

and that your domain’s files are located in:

/home/yoursite/public_html/yoursite.com/

 

This way your virtual and real hosts will have the most similar directory structures as possible.

(To do the appropriate changes, you can find your Home Directory at the left side of your cPanel below the 'Main Domain')

 

Changes to do in yoursite.conf

 

Goal: To change the folder location of ‘yoursite.com’ in Apache.

 

Open the Apache configuration folder:

C:\Program Files\EasyPHP-12.1\apache\conf\

 

Make a backup of ‘yoursite.conf’ before modifying it, and then open it to make the changes as follow:

 

<VirtualHost 127.0.0.1>DocumentRoot "Z:/home/yoursite/public_html/yoursite.com/"ServerName yoursite.com<Directory "Z:/home/yoursite/public_html/yoursite.com/">Options FollowSymLinks IndexesAllowOverride AllOrder deny,allowAllow from 127.0.0.1Deny from allRequire all granted</Directory></VirtualHost>
Stop and run Apache, then go with your browser to:

http://ww38.yoursite.com/

 

You should acceed to the new location.

 

Advantages:

 

- It’ll be easier for you to manage your stuff, as you’ll have a better view on your files and they’ll be easier to access, maintain, backup, upload, etc.

- If you do the appropriate changes, you’ll have almost a similar structure as you real web hosting.

- An another advantage is that you can install an another WAMP with a different configuration and map some Virtual Hosts to the same place if you wish so...

 

I hope you’ll enjoy it at least as I do, Cheers :-)

 

------------------------------------------------------------------------

PS: In case EasyPhp shows a warning message accessing to the new location, you can try this:)

Mapping the ‘Z:\’ in EasyPhp

Goal: To aloud EasyPhp to access files located in ‘Z:\’

In your browser, go to the administration panel:

http://forums.xisto.com/no_longer_exists/

In the local files click in add an alias, name it ‘z’ or whatever you like, and write Z:\ as the path to the directory.

Stop and run Apache, with your browser you should be able to access to

http://forums.xisto.com/no_longer_exists/

 

------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Awesome little tutorial, though I was confused by "virtual hosts." I thought this meant like how to set up subdomains.Do you happen to be able to write up a tutorial on how to do that, "automatically" if possible? I'm working on a project that deals with subdomains and I'd like users to be able to set up their own instead of having to manually edit the configuration files all the time.

Share this post


Link to post
Share on other sites

Of course Rgp,It's quite a good idea for a new tutorial, even if I never did something like this so far. I think that you can "wildcard" your subdomains, do a quick code in PHP to create and manage the respective folders and then just add a ".htaccess" url rewritting instruction at the top-level directory to redirect sub-domains properly.Well ... let's say that's in a scratch an hitch way.Otherwise, to create sub-domains in the WAMP you have to proceed exactly the same way step by step as for the domains, because the 'Host' file doesn't support wildcards.

Edited by cityzen (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.