ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Apache服务器搭建http网站入门教程

Apache服务器搭建http网站入门教程

Linux操作系统 作者:慕容钰灵 时间:2019-06-19 11:05:47 0 删除 编辑
准备工具
  一台带有Linux系统的主机,这里使用CentOS 7.1 64位系统
  一个备案过的域名,这里使用
  一台可以访问网络的pc,这里使用的Win7_pro_sp1
步骤
1、解析域名
  在域名管理控制台添加对主机ip的解析,如下图

2、Apache安装  启动CentOS系统,安装httpd
  # yum install httpd
3、配置Apache环境
  # vim /etc/httpd/conf/httpd.conf
  添加如下代码至文件末尾
  同时修改文件的以下部分,来修改默认的主目录
  同时别忘了创建此目录,否则会报错
  # cd /var/www/html
  # mkdir hellopage
  最后重新启动httpd
  # /bin/systemctl start httpd.service
4、测试
  1.打开浏览器,输入,若出现如下页面,则建立成功
  Testing 123..
  This page is used to test the proper http://www.bbqmw.net/   operation of the Apache HTTP server after it has been installed. If you can read this page it means that this site is working properly. This server is powered by CentOS.
  2.在刚刚创建的/var/www/html/hellopage/下创建html
  # cd /var/www/html/hellopage/
  # touch index.html
  # vim index.html
  添加如下代码
  <!DOCTYPE html>
  <html>
  <head>
  <title>God Sacred</title>
  </head>
  <body>
  <p>hello world!</p>
  </body>
  </html>
  3.重新登录网站


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69926532/viewspace-2648071/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-05-31

  • 博文量
    56
  • 访问量
    86874