Sunday, July 08, 2007

OpenBSD Tip: Starting Apache

Apache is included in a basic install of OpenBSD. However it is not running by default. Starting Apache in OpenBSD is really easy. You can start the server manually or automatically.

Automatic: To start Apache every time the computer starts/restarts you need to do the following:

Edit /etc/rc.conf and change this line:
httpd_flags=NO
To read:
httpd_flags="" # note the use of two double-quotes
Then save the changes. When the computer is restarted, the Apache server (httpd) will automatically start.

Manual: To start Apache manually you need to run the following command:
# /usr/sbin/apachectl start
/usr/sbin/apachectl start: httpd started


Testing your Web Server: To test your webserver point your web browser to your servers IP address, or use lynx on the webserver like this:
# lynx localhost

[ lynx displays the following ...]
[OpenBSD]
Apache
It Worked!

If you can see this page, then the people who own this host have just
activated the Apache Web server software included with their OpenBSD
System. They now have to add content to this directory and replace this
placeholder page, or else point the server at their real content.
[ ... cut ... ]
The Document Root directory (the directory where all of the server's web pages are stored) is /var/www/htdocs. You can now place your web pages in this directory.

3 comments:

PacoBell said...

I got apache working...for a while, but now I can't see that boilerplate webpage anymore from the WAN side of the box, even though it shows up just fine from within the LAN. I believe my PF ruleset is correct so, assuming it is, could there be anything else tripping up Apache?

Kris said...

I can't really say for sure, yet because apache is working from the LAN side, I would suggest the problem is something else.
Check all of your logs ;)

Anonymous said...

Why not rewrite the manual for apache 2.x or apache 2.2.x ??? There are some limitations that you run into later on using the old version of apache.