Run Your Own Unix Web Server (part 3 of 3)
by Dave Tufts - May 12, 2006 / 10:49am View more articles
Part 3 of 3 / Configuration
I know it's been a while since Part 1 and Part 2 of this series. Sorry for the long delay. I imagine thousands, if not millions, of inquisitive geeks out there with their FreeBSD servers ready to go. Apache, PHP, and MySQL are installed, and they're just waiting, reloading the iMarc blog every couple hour, wondering..."Now What?"Well the wait is over, my furry little geek friends. Cancel your World of Warcraft membership and do what real men do - run a UNIX web server.
In this lesson, we configure Apache and serve up a PHP page.
This document assumes:
- FreeBSD is installed, and you followed the instructions from part 1 of this series
- Apache 2.x and PHP 5.x are installed, and you followed the instructions from part 2 of this series.
- at least one domain name points to your server
The one I'm using is example.com. Replace that with your domain in the references below. - your server has at least one static IP address
The one I'm using is 10.20.111.2. Again, replace my example IP with your real IP below.
Make a home for your website
SSH to your server as the user 'web' and create the website root directory:
Make a homepage for your site
You can later go back and upload a better site, but for now, we'll just make a quick PHP-driven index page in the website root directory.
Use vi to create and open the index file:
"; } ?>
Edit Apache's configuration file
We need to tell Apache where the new site is. I prefer using name-based Virtual Hosts
Use vi to create and open Apache's config file, called httpd.conf:
Start Apache
Starting and stopping apache requires SuperUser (root) privileges, so type su, and enter root's password.
In case the web server was already running, we'll try and stop it first. If you get an error about apache not running, don't worry...
Finally, start the server:
Launch Party
Open up your favorite browser and go to the site!
If it worked, pour the Andre Cold Duck, submit your site to Google, jump out of the nest, and flap your wings. You're on your own now!
See Also
Run Your Own Unix Web Server (part 1 of 3) - FreeBSD Installation
Run Your Own Unix Web Server (part 2 of 3) - Software
Run Your Own Unix Web Server (part 3 of 3) - Configuration
Comments have been turned off on this blog.
Read something more recent.
5 Comments