Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

So my job is to take the homepage (or maybe I should say "homesite" because it encompasses a few interrelated pages) and drag this onto its own Apache server. The problem I'm having right now is being able to weed out jumbled/bundled files (such as folders of js, css, and other files that i cant even identify) and knowing what is necessary to keep the homesite running.

I'm new to this stuff (I'm an intern) so feel free to ask questions if I'm leaving vital information out.

What I'm asking of you guys here is basically any pointers or tips you may be able to give me in order to get the job done. I could use some advice from people with a little more experience in web development.

btw: This question may appear as though I have not completed any prior research and that is, for the most part, true. But the problem is I really am not sure how to research this. If you guys could throw me some keywords to play with that would really be helpful. Thanks!

share|improve this question

migrated from stackoverflow.com Sep 12 '12 at 23:45

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers 3

To generic question. Usually it should suffice to:

  • move scripts and files (pack all with i.e. tar) if sites use
  • database, dump all databases (do NOT move binary table files)
  • check for cronjobs

on new server unpack all stuff, import databases, update script configs to point to them, adjust httpd/php/whatever setting if you got special needs. Done.

share|improve this answer
    
I don't think this is at all what he is asking. He needs to know how to figure out which resources in a site are no longer being used. At least, that's my read. –  Brad Sep 11 '12 at 17:28
    
do NOT move binary table files -- for large databases, this is the preferable method. Shut down the database, and cp the entire database directory. I do this all the time for both mysql and postgres databases. For ~100GB databases, it's orders of magnitude faster than a dump/reimport. It is easy to shoot yourself in the foot if you don't know what you're doing, though. –  Frank Farmer Sep 11 '12 at 17:30
    
@FrankFarmer, I doubt this guy is working with 100GB databases. In his case, it is definitely appropriate to do a dump to SQL. In any case, if you do move the binary versions, it is important to point out that the proper upgrade commands be run, and re-indexing may also be necessary. –  Brad Sep 11 '12 at 17:31
    
@FrankFarmer sure, but only if you know you got no binary format mismatch. He does not look experienced much and this is not "sysadmin for dummies" :) –  WebnetMobile.com Sep 11 '12 at 17:31
    
@Brad maybe you are right. But most sites usually sit nicely in one folder (and subfolders) so my approach may suffice as well. If he got something ultra-crappy-custom-tricky-made which spreads everywhere on the disk, then it might be cheaper to pay someone to fight this mess though –  WebnetMobile.com Sep 11 '12 at 17:33
add comment

There are two ways to do this, both of which are a bit tedious.

Method #1: Search the code

Use a tool to do a text search throughout all of your code for each file name. (Just the file name, not the path! Relative paths are often used.) Then, make a determination for each instance whether or not that file is in use. This is a real hassle, but important.

Method #2: Analyze server logs

Run a crawler on all of your pages. Check your server's access log. Write a script to (or manually) search through that log for each file name in your source tree to see if it was accessed. Danger Will Robinson, as this will not catch included files! This is only useful for resources loaded client side, such as CSS, JS, and images. Also beware of minification that hide that these files are in use.

Finally, when you are all done, be sure to check error logs and what not to see if you broke anything. Make backups (and/or version control!) as you go.

share|improve this answer
add comment

It all depends on wether the site is driven by a database and serverside scripting, or if it is just a bunch of html, css, js and media. For simple sites there are tools out their that allow you to download an entire website. I often work with Sitesucker (http://www.macupdate.com/app/mac/11634/sitesucker) on the mac, but there should be plenty of tools for other platforms as well. I believe there are even some browser plugins available. I'm not sure if it will be as easy as copying the output from these tools to your server, but it should give you a good starting point.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.