1.1 Questions
This example is required to quickly build a Web site server on a Linux host, successfully implement Web page deployment and access, and complete the following tasks:
1) Build Web services on CentOS7 virtual machines
安装 httpd 软件包将系统服务 httpd 设为开机自启,同时启动此服务为默认网站创建首页文件 index.html(自建或程序员提供)
2) access to native Web resources via Firefox firefox browser
1)打开 firefox 火狐浏览器2)在火狐浏览器中输入网址 http://127.0.0.1/ ,确认网页结果
1.2 Solutions
When you turn on network service applications such as WEB/FTP in a CentOS7 system, you may receive security policy effects such as firewall, SELinux, and so on, which are configured by default. To avoid interference, these protection mechanisms are recommended in the learning process.
To turn off firewall policy:
[[email protected] ~]# systemctl stop firewalld.service //设置开机禁用防火墙[[email protected] ~]# systemctl disable firewalld.service //关闭防火墙
Turn off the SELinux protection mechanism:
[[email protected] ~]# setenforce 0 //立即切换为宽松模式[[email protected] ~]# getenforce //确认结果Permissive[[email protected] ~]# vim /etc/selinux/config //以后开机不再强制生效SELINUX=permissive //宽松模式
1.3 Steps
The implementation of this case needs to follow the steps below.
Step one: Build a Web service on the CentOS7 virtual machine
1) Install the HTTPD package
[[email protected] ~]# yum -y install httpd.. ..已安装: httpd.x86_64 0:2.4.6-45.el7.centos 完毕!
2) Set the system service httpd to boot and start the service at the same time
[[email protected] ~]# systemctl enable httpd //设为开机自启Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.[[email protected] ~]# systemctl restart httpd //启动此服务
3) Create a home file for the default website index.html (built-in or programmer-supplied)
[[email protected] ~]# vim
Step Two: Access native Web Resources via Firefox firefox browser
1) Open Firefox firefox browser
2) Enter the URL http://127.0.0.1/in Firefox to confirm the page results
Build and access your Web site