Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I wanted to setup a test server on my home network so I can develop my website locally and just update my website when I have the kinks worked out. I have begun to learn php this summer (I am a student worker for the university I attend), and at work we have the website setup up in a subversion repository. We then do our work on a development site which is different than the live site. When it is time to update the live site, my boss "copies" (I assume I don't know for sure) the repository data to the live site. It seems as though my boss doesn't have to change any links etc. in the code. The reason I think it "just works" is because of the fact that everyone that works on the site accesses the dev site using a different url. My question is: How do I achieve this same (or similar) server setup for myself? If you are wondering I am using Ubuntu 9.04 desktop edition, with (what I assume is installed correctly) LAMP server.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

I assume that "behind the scenes" there is a script that retrieves the latest updates from the repository and then replace some data. For example is the dev site is dev.net and the production site is prod.net, the script replaces all the occurrences of dev.net with prod.net, also the script need to check if the connection to the database is pointing to the right database server.

share|improve this answer

Use apache for hosting websites. If something from apache, mysql, php is missing you can install that using apt-get or synaptic. The website works just by copying probably because relative links are used instead of absolute links.

For example, if you want to link to folder b inside folder a then there are two ways

<a href="b/other.php"> Link </a>

and

<a href="http://localhost/a/b/other.php"> Link </a>

The first one is relative and second is absolute link. If you prepare site using relative links only then the site will work by copy-paste without any problem.

share|improve this answer
    
FWIW, the third option would be: <a href="/a/b/other.php">Link</a> –  Lazlow Jul 16 '09 at 19:18

The reason that he doesn't have to change links is probably because everything in the application is using relative URL's. So a link to a page would be "/services.html" instead of "http://www.mydomain.com/services.html".

The live site may actually be in a repository, too, in which case you boss might have a script that downloads the latest version from the dev repo to the prod repo, then commits the prod repo.

share|improve this answer

Your Answer

 
discard

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