Apache, Controlling

From FreeBSDwiki
Revision as of 06:12, 2 August 2012 by DavidYoung (Talk | contribs)
Jump to: navigation, search

Want to see if it works? If you just got done installing Apache, first of all, issue a rehash command to reindex your system's PATH. Then let's get started:

ph34r# apachectl start
/usr/local/sbin/apachectl start: httpd started

Don't take its word for it, though - sometimes apachectl lies through its teeth. Let's make sure we really do have some httpd processes running:

ph34r# ps ax | grep http
18564  ??  SsJ    0:00.74 /usr/local/sbin/httpd
18566  ??  IJ     0:02.71 /usr/local/sbin/httpd
18567  ??  IJ     0:01.12 /usr/local/sbin/httpd
18568  ??  IJ     0:00.64 /usr/local/sbin/httpd
18569  ??  IJ     0:02.10 /usr/local/sbin/httpd
18570  ??  IJ     0:06.16 /usr/local/sbin/httpd
18612  ??  IJ     0:03.00 /usr/local/sbin/httpd
18621  ??  IJ     0:03.94 /usr/local/sbin/httpd
18639  ??  IJ     0:05.96 /usr/local/sbin/httpd
18644  ??  IJ     0:01.60 /usr/local/sbin/httpd
18645  ??  IJ     0:02.05 /usr/local/sbin/httpd

Okay, good, looks kosher. You're probably going to want Apache to run automatically whenever the server boots, though, right? Well, there are two ways to go about doing that. One way is to edit /etc/rc.conf and set some variables that will then cause the default / startup script that the port placed in /usr/local/etc/rc.d to actually do something when the machine starts... but we're not going to talk about that way, because I personally despise forcing the administrator to maintain two files where one would do. So instead, we're just going to write our own script for /usr/local/etc/rc.d that will start Apache all on its lonesome, regardless of what is or isn't in /etc/rc.conf. So make yourself a new script and name it /usr/local/etc/rc.d/, and make it look like this:


case "$1" in
        /usr/local/sbin/apachectl start > /dev/null && echo -n ' apache'
        /usr/local/sbin/apachectl stop > /dev/null && echo -n ' apache'
        echo "Usage: `basename $0` {start|stop}" >&2

exit 0

Now you'll want to make sure that your new script 1. can get executed when the system starts, and 2. won't get clobbered the next time you upgrade Apache from the ports tree, so make it executable but NOT writeable:

ph34r# chmod 555 /usr/local/etc/rc.d/

There you go - now that you've got a handle on starting and stopping Apache, move on to the basics of Configuring Apache.


9 Reasons Why You Should No Longer Care About Peoples Approval

A truly strong person does not need the approval of others any more than a lion needs the approval of sheep. Vernon HowardApproval Seeking Behavior If you ask me, this is where many of our challenges start. When you are too concerned with what other people think of you, you start sabotaging your life, and you start moving forward but with the breaks on.

[9 Reasons Why You Should No Longer Care About Peoples Approval]

[ - good, positive news, inspirational stories, articles]

How to Think Like an Ecosystem

Gradually its dawned on me: We humans are creatures of the mind. We perceive the world according to our core, often unacknowledged, assumptions. They determine, literally, what we can see and what we cannot. Nothing so wrong with that, perhapsexcept that, in this crucial do-or-die moment, were stuck with a mental map that is life-destroying.

[How to Think Like an Ecosystem]

[ - good, positive news, inspirational stories, articles]

Bangladesh rickshaw puller starts clinic for the poor

Joynal Abedin still remembers the rainy and windy night when he saw his father die because there was no medical treatment. His village in the northern Mymensingh district of Bangladesh did not have any medical facility at that time, and the nearest hospital was about 20km (12 miles) away.

[Bangladesh rickshaw puller starts clinic for the poor]

[ - good, positive news, inspirational stories, articles]

Not Your Usual Panhandler

Doug Eaton wanted to celebrate his birthday on June 11 in a big way, so he turned to his friends for ideas -- ended up marking the day with random acts of kindness, including handing out free money to people passing by.

[Not Your Usual Panhandler]

[ - good, positive news, inspirational stories, articles]

The Secret to Success Kindness

Take a look at these simple but powerful words from the Dalai Lama, Kindness and a good heart are the foundation for success in this life, progress on the spiritual path, and the fulfillment of our aspirations. Our need for them is not limited to any specific time, place, society, or culture.

[The Secret to Success Kindness]

[ - good, positive news, inspirational stories, articles]

Personal tools