赞
踩
在centos上安装apache和在ubuntu上安装apache有些区别。如果使用的是ubuntu系统,请查看:https://blog.csdn.net/weixin_42912498/article/details/102922116
在centos上安装有如下步骤:
1)安装apache
yum install httpd
2)设置开机自启动
systemctl enable httpd.service
成功显示:Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
3)手动启动、停止和重启
- systemctl start httpd.service
- systemctl stop httpd.service
- systemctl restart httpd.service
4)在启动时发现有如下报错:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
原因是apache默认使用80端口,而80端口已经被占用了。
查看80端口所在进程:
lsof -i:80
果然,已经被nginx给占用了
将nginx关掉:
nginx -s stop
再次手动启动apache,启动成功。再次查看80端口,已经变成apache了
通过ip进行访问,显示如下页面
5)安装php及其扩展
yum install php php-mysql php-common php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
安装成功后重启apache,通过 php -v 查看php版本
6)如果想要使nginx和apache可以同时启动,请查看:https://blog.csdn.net/weixin_42912498/article/details/106626219
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。