Sunday, March 14, 2010

apache2: bad user name ${APACHE_RUN_USER}

I am used to compiling(almost always) the apache 2 server on linux. However, this time when I set up my new ubuntu machine, I decided to try the mighty apt-get/package manager. After installation I tried browsing to http://localhost/ and was quite happy to see the server running.

Sometime later, I felt the need to restart apache. When I tried to restart using the apachectl command, it said command not found. Surely, things were different from how it would have been if I had compiled apache manually.

Doing a "ps -ef | grep apache" showed me the process running as
/usr/sbin/apache2 -k start
Thinking that, probably, thats how we start it in this distro(if installed using apt-get), I tried running the following to restart the webserver,
sudo apache2 -k restart
but I was disappointed to see this message show up,
apache2: bad user name ${APACHE_RUN_USER}
Spending sometime on google and the ubuntu forums and I figured that I was running the wrong command.

Both of these commands(below) worked for me,
sudo apache2ctl -k restart
or
sudo /etc/init.d/apache2 restart
Moreover, apache is not installed where it would be if compiled(it defaults to /usr/local/apache2).

Although the installation was smooth and extremely easy, it still makes me wonder if things(config/folders/etc) would be better if left default?

1 comment: