Change DocumentRoot in Apache to avoid 404 errors

Q I am setting up an old machine to use as a web server internally on my office network. This is for design purposes before uploading sites to a web host. I am using Mandrake 9.0 and Apache/PHP and have it running OK. I can open the web server using 192.168.0.3:80, which opens the file at /var/www/html/index.shtml. I have replaced this file with my own index.html, which is fine. I would like to keep the files for the websites on /home and would like to know how to reference them. I have tried, temporarily, accessing a content management system at /home/mike/tmp/cinj152/index.php as a link but get a 404 error. What am I doing wrong?

A The root directory for your web services is set by the DocumentRoot option in /etc/apache/httpd.conf. Changing this to /home/mike/tmp/cinj152/, rather than /var/www/html will result in the functionality you need You may also want to move your website into /home/mike/public_html, then you can simply do http://192.168.0.3/~mike/, and get your site.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar