Running Apache Under Unix
When you run Apache now, you may get the following error message:
httpd: cannot determine local hostname Use ServerName to set it manually.
What Apache means is that you should put this line in the httpd.conf file:
ServerName <yourmachinename>
Finally, before you can expect any action, you need to set up some documents to serve. Apache’s default document directory is ... /httpd/htdocs — which you don’t want to use because you are at /usr/www/APACHE3/site.toddle — so you have to set it explicitly. Create ... /site.toddle/htdocs, and then in it create a file called 1.txt containing the immortal words “hullo world.” Then add this line to httpd.conf :
DocumentRoot /usr/www/APACHE3/site.toddle/htdocs
The complete Config file, .../site.toddle/conf/httpd.conf, now looks like this:
User webuser Group webgroup ServerName my586 DocumentRoot /usr/www/APACHE3/site.toddle/htdocs/ #fix 'Out of the Box' default problems--remove leading #s if necessary #ServerRoot /usr/www/APACHE3/APACHE3/site.toddle #ErrorLog logs/error_log #PIDFile logs/httpd.pid #TypesConfig conf/mime.types
When you fire up httpd, you should have a working web server. To prove it, start up a browser to access your new server, and point it at http://<yourmachinename>/.[3]
As we
know, http means use the HTTP protocol to get
documents, and / on the end means go to the
DocumentRoot
directory you set in
httpd.conf.
Lynx is the text browser that comes with FreeBSD and other flavors of Unix; if it is available, ...
Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.