欢迎光临
我们一直在努力

linux服务器怎么搭建网站

linux服务器搭建网站的案例:

1.打开终端控制台,输入命令:“yum -y install httpd”,安装web服务软件。

2.输入命令:“systemctl start httpd”,启动httpd服务。

3.输入命令:“vim /etc/httpd/conf/httpd.conf”。进入主配置文件。

4.输入命令:“vim /etc/httpd/conf.d/httpd-vhosts.conf”。编辑一个子配置文件,代码:

<VirtuaLHost *:80>

DocumentRoot "/ var/www/htmt"

<Directory "/var/www/html">

<RequireAll>

Require all granted

</RequireAll>

</Directory>

</VirtuaLHost>

5.输入命令:“systemctl restart httpd ”。重启服务。

6.输入命令:“cat /var/www/html/index.html”。查看index.html 文件中的内容。

7.输入命令:“ifconfig ens33”。查看ens33网卡的地址。

8.在浏览器中输入地址即可访问。

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。