apache-httpd安装httpd.service配置
编辑这个文件 vi /usr/lib/systemd/system/httpd.service 写入如下配置 [Unit] Description=The Apache HTTP Server After=network.target [Service] Environment=LANG=C Type=forking ExecStartPre=/opt/apache2/bin/httpd -f /opt/apache2/etc/httpd.conf -k start ExecStart=/opt/apache2/bin/httpd -f /opt/apache2/etc/httpd.conf -k start ExecReload=/opt/apache2/bin/httpd -f /opt/apache2/etc/httpd.conf -k restart ExecStop=/opt/apache2/bin/httpd -f /opt/apache2/etc/httpd.conf -k stop PrivateTmp=true [Install] WantedBy=multi-user.target
重启生效
systemctl daemon-reload systemctl restart httpd