< Day Day Up > |
Recipe 22.6. Setting Up a Simple Public Web Server22.6.1 ProblemYou want to build a simple public web server for a single domain, serving up static HTML pages. 22.6.2 SolutionAfter installing Apache 2.0, confirm that the location of your web site directory in httpd.conf is set correctly and that the directory exists: DocumentRoot /var/www/bratgrrl Copy your web pages to your DocumentRoot directory (in this case /var/www/bratgrrl). Then start up Apache: # apachectl start Configure DNS to point to your web server, and you're done. 22.6.3 DiscussionTo run a public web server, you need a registered domain name and a static IP address for your web server. It can be a public, routable IP, or a private IP behind a NAT gateway. Yes, you can play fun DNS tricks on a dial-up account with a dynamically assigned IP using services such as dyndns.org, if your terms of service allow you to run servers and if you just want to run a pretend web site as a learning exercise. Don't do this for a serious web site. Hosts on your LAN can access your web site by either IP address or hostname: http://windbag http://192.168.1.5 This is good way to test connectivity and to preview your web pages. If you installed Apache from packages, look in /etc/init.d for the startup script. It probably has one of the following names. # /etc/init.d/apache2 # /etc/init.d/httpd # /etc/init.d/httpd2 Typically these are simple start/stop/restart/reload/force-reload scripts that verify file locations and call apachectl. (Be aware that many distributions rename apachectl as apache2ctl.) Be sure that your init script calls apachectl, and not the httpd binary. The Apache maintainers recommend starting and stopping Apache with apachectl only:
22.6.4 See Also
|
< Day Day Up > |