How start apache in centOS 7

笑着哭i 提交于 2019-12-11 10:49:13

问题


I was starting Apache using this command : service httpd start in centOS6


Today I did download centOS7-64bit-minimal and wanted to start Apache after installing this.
When I use service httpd start, os will show me a message says:

Redirecting to /bin/systemctl start httpd.service


Should I use [root@localhost#] /bin/systemctl start httpd.service??

I tried [root@localhost#] systemctl start httpd.service and it seems it's OK, but in the centOS6, there was starting status with something like [OK] or [FAILED] after starting httpd or something like that, but in this version, there is no report...
Am I in right way?
Is httpd started correctly after this command :
[root@localhost#] systemctl start httpd.service ?

Thanks in advance...


回答1:


Welcome to Systemd! This has replaced service in recent Red Hat ilk, such as CentOS 7. You are on the right track with systemctl. Now, instead of checking logs in /var/log/messages/, you use journalctl to view logs. To look at logs specific to “httpd”, you can look at the “unit” with:

journalctl -u httpd

Other useful things to do with journalctl:

alias jc='journalctl -xa'  # make a friendly alias for ease of typing
jc -f  # follow the current events



回答2:


you are doing it right. It sends your command to httpd service. You can use this command to see status of last command sent:

service httpd status



回答3:


Triggering the httpd service start must be changed.. Suggested way:

systemctl start httpd.service

This would help in Linux EC2 instances.. Helped me though



来源:https://stackoverflow.com/questions/32021476/how-start-apache-in-centos-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!