apache foundation, apache environment to build three ways you can use the apache (IP, port, domain name)

On a single server to run multiple Web sites simultaneously, based on domain names, IP access, port access. Http port service using 80 HTTPS using 443

URL web components

Agreement Name: // machine address: port number / path / file

Protocol name - access protocol used. Such as http, ftp.

Machine location - where machine data, IP address / domain name

Port Number - Port data source the requested data (can be omitted)

Pathname - relative path to where the data resides

Filename - the file name of the requested data

 

 

web is divided into client and server components

Server: The main function is to provide services

Client: The main is to send a request to the server

Companies such as Baidu, Baidu's server in the main function:

 

Then the web browser is the client main function is:

 

 

 

 

For example the transmission request 200 is successfully received and processed by the server successfully

404 page does not exist

443 enough authority

500 server configuration error

 

Apache default configuration:

This no apache user default, a user generated automatically finished when the virtual machine configuration apache service, and belongs to the system user.

 

 

After the ping yum yum repository using the command to download and install httpd service

 

 

 

 

 Can look at the system has automatically created apache user. Because it is not the root user privileges so small, you can use a few commands, will not significantly affect the host upon which the virus can only do him some of the things in the apache user rights. As far as possible to minimize user access to the server configuration file.

 

 After installing the httpd service you need to configure the httpd service, such as boot enable and so on.

systemctl start httpd service httpd start to see httpd service and 80-port status.

 

 80 Port:

 

Set boot:

 

 In var / www / html can set the homepage but the configuration file is turned on by default index.html, if not the home page file name index.html, then, we need to change the configuration file index.html for himself renamed file name can. This page does not need to enter the name of the file can be opened directly homepage.

For example, we have written the following files in the home directory html

 

 那么我们在应用程序中的浏览器输入IP地址(192.168.2.100也可以加上端口,192.168.2.100:80,或者http://localhost,当然这里用127.0.0.1也是可以的,他代表虚拟机本身,比如ping 127.0.0.1和ping localhost是一样的)就可以显示主页文件了(这里最后不加/index.html也是可以的,因为配置文件里已经写好了)。

 

 

如果想要修改默认文件名,需要更改httpd.conf文件中的配置,将index.html改成自己想设置的名字。改完之后需要重启httpd服务才会生效。

 

 有关httpd服务的文件

 

 关于httpd.conf配置文件里的参数解释

 

 

 

apache服务程序配置文件分为3种类型:注释行信息、全局配置、区域配置

 

 

 

 练习1 将网站数据放在/home/wwwroot目录

第1步:编辑Apache服务程序的主配置文件,将其做如下图所示修改。

 

 

 

 

 第2步:建立网站数据目录:

 

 第3步:创建首页文件:

 

 第4步:重新启动Apache服务:

 

 第5步:查看首页

 

Guess you like

Origin www.cnblogs.com/Zh1z3ven/p/11773390.html