The usual thing is that you have a folder that's exposed on the web and using your favorite web browser you can make the server send you files stored in the folder in question. There's nothing special about that. What's actually very annoying is that every time you do some changes there's a need to upload the new files to the server.
There's been tons of different solutions to that issue ranging from automated synchronization agents to manual ftp operations. The one solution I like most is to use Git to do the heavy lifting for me. Here's how it's done.
You have a repository at, let's say, /srv/git/my-website.git and want to keep the actual files to be served at /var/www. To make git populate the latest versions of your files once you've pushed your changes you need to:
1. Create a file named
/srv/git/my-website.git/hooks/post-receivewith the following content:
2. Set it's permissions so that it is executable
#!/bin/sh GIT_WORK_TREE=/var/www git checkout -f
3. Set the ownership of
chmod +x /srv/git/my-website.git/hooks/post-receive
/srv/git/my-website.git/hooks/post-receiveso that whatever user runs the server process can execute it.
And before I forget: the destination folder needs to already exist and the user that's managing the repository (for example "git" or "apache") needs to have read/write access to that folder!
And that's it! Once you do a
git pushyour changes will be automatically propagated to the proper folder :)