\subsection{Service}apache
在/usr/local/apache2/conf/httpd.conf中設置ServerName後,接下來可使用apachectl來啓動httpd。bash
\begin{lstlisting}[language=bash]io
$ sudo /usr/local/apache2/bin/apachectl starttest
$ ps aux | grep httpdgrep
root 1001 0.0 0.0 71280 3700 ? Ss 00:18 0:00 /usr/local/apache2/bin/httpd -k startstl
daemon 1002 0.0 0.1 427868 4100 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k startmargin
daemon 1003 0.0 0.0 427868 3852 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k starttop
daemon 1004 0.0 0.0 427868 3852 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k startvi
daemon 1089 0.0 0.0 427868 3856 ? Sl 00:18 0:00 /usr/local/apache2/bin/httpd -k startco
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}