1 Answer
1

You have the right idea, but you'll need to put your "courses.php" in a folder, most likely. So your structure would be more like /var/www/courses/index.php (index.php is generally the default file a web server looks for, this allows you to do something like "http://courses" without dealing with rewrite engines).

You then need to set up an Apache virtual host to match up your new folder with a domain name. You can find this in /etc/httpd/sites-available or /etc/apache2/sites-available, depending on your setup. In your virtual host file, you'll have something like:

See Apache's documentation for more stuff you can do. You'll need to edit this file with elevated privileges, so in a terminal, you'll have to run gksu gedit /path/to/virtual/hosts/file.

Once you add that, make sure your virtual hosts file is symlinked to sites-enabled (if not, run sudo ln -s [/etc/httpd/sites-available/realfile] [/etc/httpd/sites-enabled/nameofrealfile] replace the stuff in brackets with the appropriate paths and file name (the symlink name is conventionally the name of the real file). Then, restart Apache, so that it picks up the new virtual host information.

If you're running PHP files, then you'll need to make sure you have PHP5 installed (sudo apt-get install php5) and make sure the Apache module is activated sudo a2enmod php5.

Finally, you need to associate you local web server with the domain name you've chosen earlier. For that, you'll need to edit your HOSTS file, which is located in /etc/hosts. Like your vitual host file, the HOSTS file requires elevated privileges, so open it with gksu gedit /etc/hosts. Then, below the other entries in it, add a line with 127.0.0.1 yourdomain (where "yourdomain" is the domain name you've chosen), then save and close the file.

Once that's done, you should be able to see the contents of your /var/www/courses folder. Ideally, you'll have an index file, and it will pick it up. If you have an index.php file, and it's not reading it, you may have to tell Apache to look for .php extensions for index files.