云主机配置

  1. 购买centos的云主机
  2. 使用ssh访问云主机
ssh [email protected]

编写html文件

<html>
<title>Hermann_Hesse</title>

<head></head>

<body>
    <h1>Hermann Hesse</h1>
    <a href="https://en.wikipedia.org/wiki/Hermann_Hesse">From Wikipedia</a>
    <p>Hermann Karl Hesse (2 July 1877 - 9 August 1962) was a German-born poet, novelist, and painter. His best-known
        works include Demian, Steppenwolf, Siddhartha, and The Glass Bead Game, each of which explores an individual's
        search for authenticity, self-knowledge and spirituality. In 1946, he received the Nobel Prize in Literature.
    </p>
    <div>
        <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Hermann_Hesse.jpg/220px-Hermann_Hesse.jpg">
    </div>
    <h2>Famous Bibliography</h2>
    <ul>
        <li>(1922) Siddhartha <em>novel</em></li>
        <li>(1927) Der Steppenwolf <em>novel</em></li>
        <li>(1943) Das Glasperlenspiel <em>(The Glass Bead Game; also published as Magister Ludi) novel</em></li>
    </ul>

</body>

</html>

在centos云主机搭建apache环境

  1. 安装Apache
sudo yum install httpd
  1. 安装完成后,启用并启动Apache服务
sudo systemctl enable httpd
sudo systemctl start httpd
  1. 打开HTTP和HTTPS端口80和443,以便外部能够访问
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

浏览器中打开服务器IP地址,看到默认的Apache欢迎页面,说明apache安装成功
web开发(1)环境搭建与静态页面配置

apache工作目录配置

打开apache的主配置文件

nano /etc/httpd/conf/httpd.conf

web开发(1)环境搭建与静态页面配置

参数DocumentRoot是网站数据目录,默认为/var/www/html
打开http://serverIP,将自动访问/var/www/html 下的index.html
使用scp命令,将文件上传到云主机/var/www/html目录下

scp /path/filename [email protected]:/path  

此时打开http://serverIP,可显示自定义的网页
web开发(1)环境搭建与静态页面配置

配置域名解析

修改域名解析的记录值为云主机的域名地址
web开发(1)环境搭建与静态页面配置

便可以直接使用网址访问到该页面
web开发(1)环境搭建与静态页面配置

相关文章:

  • 2021-08-01
  • 2022-01-16
  • 2021-08-26
  • 2021-04-28
  • 2021-04-11
  • 2021-11-03
  • 2021-12-05
猜你喜欢
  • 2021-12-07
  • 2021-11-19
  • 2021-08-15
  • 2021-11-30
  • 2022-12-23
  • 2021-06-14
相关资源
相似解决方案