This tutorial should help you to change the
DocumentRoot of your website by using Apache2 Virtual Hosts.
The focus of the tutorial is on how to host more than one domain or subdomain on the same Raspberry Pi server, but it should also work just to move your
DocumentRoot to something like this:
The advice below should work, but since you have root on the system, there is a simpler solution: you can change Apache2's document root by editing the global configuration files under
as described in the tutorial linked above.
I'm leaving my original advice intact below, because it may help others who want to host a pset7-esque site in a shared hosting environment where they may not have access to the global Apache2 configuration.
This can be done, but you'll need to think outside the box.
You can make
/var/www into your
public directory. Put all the public stuff directly in there. The other stuff does not belong in your public directory, anyway. But where will you put it?
One way to handle this would be to copy the entire
pset7 directory into your
/opt directory (which is, by convention, a good place to install custom software which is not managed by your distro's package manager). Then:
mv /opt/pset7/public/* /var/www/
This may require
If you are in a shared hosting situation and do not have access to
/opt, you can achieve a similar effect by putting the
pset7 directory somewhere else inside your home directory, but outside of the
No matter where you put them, moving these files will cause some breakage, and you'll need to edit some
require() statements to look for
Outside of your public directory, everything else should be in the same relative position, so relative pathnames should not break!
Hope this helps.