\subsection{Service}
在/usr/local/apache2/conf/httpd.conf中设置ServerName后,接下来可以使用apachectl来启动httpd。
\begin{lstlisting}[language=bash]
$ sudo /usr/local/apache2/bin/apachectl start
$ ps aux | grep httpd
root 1001 0.0 0.0 71280 3700 ? Ss 00:18 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1002 0.0 0.1 427868 4100 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1003 0.0 0.0 427868 3852 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1004 0.0 0.0 427868 3852 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1089 0.0 0.0 427868 3856 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k start
test 1120 0.0 0.0 113000 2304 pts/1 S+ 00:20 0:00 grep --color=auto httpd
\end{lstlisting}
修改httpd.conf并添加新的Apache的用户和用户组:
\begin{lstlisting}[language=bash]
$ sudo useradd apache
$ sudo groupadd apache
$ sudo /usr/local/apache2/bin/apachectl stop
$ ps aux | grep httpd
$ sudo /usr/local/apache2/bin/apachectl start
$ ps aux | grep httpd
\end{lstlisting}