Under Linux start and stop apache service

As used herein, the Linux system is CentOS 7, the following describes the start apache service, close to the set. apache In CentOS 7 is generally installed by default, and the service name for httpd.

1. Install and view the apache configuration

# apache安装命令

$ sudo yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package httpd-2.4.6-45.el7.centos.4.x86_64 already installed and latest version
Nothing to do


# 查看apache文件的位置

$ sudo find / -name httpd
/run/httpd
/etc/logrotate.d/httpd
/etc/sysconfig/httpd
/etc/httpd
/var/log/httpd
/var/cache/httpd
/usr/sbin/httpd
/usr/lib64/httpd
/usr/share/httpd
/usr/include/httpd
/usr/libexec/initscripts/legacy-actions/httpd

Apache configuration file is located in /etc/httpd/confthe main configuration file is /etc/httpd/conf/httpd.conf, apache configuration information can be seen in this file.

2. apache start the service on and off

# Start Service 
$ sudo systemctl Start httpd.service 

# View service 
$ PS the AUX | grep httpd 
root      *   0.3   0.0  220 444   4956 Ss?    15 : 46    0 : 00 / usr / sbin / httpd - DFOREGROUND 
the Apache    *   0.0   0.0  220 444   2492 ? S     15 : 46    0 : 00 / usr / sbin / httpd - DFOREGROUND 
the Apache    *   0.0   0.0  220 444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488? S     15 : 46    0 : 00 / usr / sbin / httpd - DFOREGROUND 

# stop the service 
$ sudo systemctl STOP httpd.service 

# restart the service 
$ sudo systemctl restart httpd.service

 

Guess you like

Origin www.cnblogs.com/azhqiang/p/12096020.html