If you want X folder in dropbox (~/Dropbox/X) to act as your www root folder, edit /etc/apache2/sites-available/default and replace /var/www/ with /home/<username>/Dropbox/X. Make sure that files inside the X folder are readable by www-data user.
If you want to add /var/www/ to your Dropbox, and keep it synced, create a symlink inside ~/Dropbox/ to point to /var/www
ln -s /var/www www
(You might wanna chown the www folder, so as to add files to it, without using root.