Centos7 configure http server

2021-1-20 Hyp
1. Install http, use command

yum install -y httpd

2. Restart the http service and
close the service

  httpd service stop

Start service

 httpd service start

Restart service

 httpd service restart

3. Test run
Use a browser to visit localhost or 127.0.0.1 and
a test page appears, that is, the service starts successfully
Insert picture description here

4. Make your own test webpage Create a new index.html file in the /var/www/html/ directory

	vim /var/www/html/index.html
输入
	<h1>hello word</h1>

Press esc: qw to save and exit

Access server

	curl 127.0.0.1

Local access is successful
Local access is successful

5. Configure apache

vim  /etc/httpd/conf/httpd.conf  #打开apache配置文件

Remove the servername comment and edit your own configuration

#ServerName=www.exmpel.com :80 
#修改为
ServerName=localhost:80

Guess you like

Origin blog.csdn.net/m0_52425873/article/details/112910402