温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何使用CentOS 7.4搭建Apache网站服务

发布时间:2020-05-27 23:18:39 来源:亿速云 阅读:259 作者:鸽子 栏目:系统运维

一、安装Apache服务

关于安装Apache详细配置及原理概述请参考:CentOS 7.4搭建Apache网站服务

[root@centos01 ~]# mount /dev/cdrom /mnt/      <!--挂载LAMP光盘-->
[root@centos01 ~]# cp /mnt/* /usr/src/       <!--将mnt目录下的程序包拷贝到/usr/src/-->
[root@centos01 ~]# mount /dev/cdrom /mnt/     <!--切换操作系统光盘-->
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-*   <!--删除系统自动yum-->
[root@centos01 ~]# tar zxvf /usr/src/httpd-2.2.17.tar.gz -C /usr/src/  <!--解压缩Apache包-->
[root@centos01 ~]# cd /usr/src/httpd-2.2.17/    <!--进入Apache目录-->
[root@centos01 httpd-2.2.17]# ./configure 
--prefix=/usr/local/httpd 
--enable-so 
--enable-rewrite 
--enable-charset-lite 
--enable-cgi          <!--配置httpd-->
[root@centos01 httpd-2.2.17]# make && make install      <!--编辑和安装httpd-->
[root@centos01 ~]# ln -s /usr/local/httpd/bin/* /usr/local/bin/     <!--优化程序执行命令-->
[root@centos01 ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd <!--生成apahce服务-->
[root@centos01 ~]# chmod +x /etc/init.d/httpd       <!--添加执行权限-->
[root@centos01 ~]# vim /etc/init.d/httpd     <!--修改Apache服务控制文件-->
#chkconfig:35 80 20 
#description:apache 
[root@centos01 ~]# chkconfig --add httpd       <!--添加为系统服务-->
[root@centos01 ~]# chkconfig --level 35 httpd on  <!--设置开机自动启动-->
[root@centos01 ~]# vim /usr/local/httpd/conf/httpd.conf    <!--修改Apache主配置文件-->
98 ServerName 192.168.100.10:80     <!--修改服务器IP地址-->
[root@centos01 ~]# systemctl start httpd     <!--启动Apache服务-->
[root@centos01 ~]# netstat -anptu | grep 80   <!--监听Apache端口号-->
tcp6       0      0 :::80                   :::*                    LISTEN      53682/httpd         

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI