linux服务器怎么搭建网站

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.在浏览器中输入地址即可访问。



声明:本站所有作品(图文、音视频)均由用户自行上传分享,或互联网相关知识整合,仅供网友学习交流,若您的权利被侵害,请联系 管理员 删除。

本文链接:http://news.ew35.com/