|The Cloud Catcher by kanelstrand (CC BY-NC-SA)
Vagrant provides an excellent solution to this. You start out with a base box and then define what your box should actually contain by using provisioning. This way you can describe which dependencies your environment should fulfill. The provisioner will then set it up accordingly.
After you have set up a box this way you can access it via a ssh tunnel. You can share your project directory with Vagrant virtual machine, run the project there and preview it on your host using your favorite browser and tools.
Vagrant is dead easy to use and makes these sort of scenarios way easier to handle. It is great in a team environment too. Just set it up once and share the configuration. Your team mates, on different platforms even, can use the same virtual machine for development.
Taken further the virtual machine you use to develop your project should mimic the server environment as closely as possible. One less issue to worry about. Better yet you can set up your provisioning so that it's easy for you to deploy and maintain. No need to ssh to your server manually, fiddle with it and cross your fingers anymore!
If you feel like taking Vagrant for a ride, I've gathered a bunch of starting points for you in the listing below. Enjoy!