zoukankan      html  css  js  c++  java
  • 建立个人网站

    1. 服务器和域名

    云服务器用的是阿里云的t5,系统是 Ubuntu 18

    域名也是在阿里云租的,完成备案.

    2. 搭建web服务

    我这里使用的时 Apache

    1. 安装  

    apt install apache2 -y

    2. 检查服务是否启动  

    systemctl status apache2

    Apache的常用操作命令

    /etc/init.d/apache2 start       //启动Apache服务
    /etc/init.d/apache2 stop       //停止Apache服务
    /etc/init.d/apache2 restart    //重启Apache服务

    3.服务器已经启动,现在就可以输入主机的IP或者服务器公网IP访问(域名访问稍后),此时访问到的是Apache默认的页面。

     

    4.修改Apache的网站根目录和默认网页。

    修改根目录

    在 /etc/apache2/sites-available/000-default.conf 文件的

    修改000-default.conf中的配置

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html    //这是网站根目录

    修改默认网页

    在 /etc/apcahce2/mods-available/dir.conf  下面是默认的,表明在访问到下面的文件

    <IfModule mod_dir.c>
        DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm 
    </IfModule>

    在里面添加一个目录 /test 同时在 /var/www/html 目录下建立一个 /test 目录

        <IfModule mod_dir.c>
            DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm /test
        </IfModule>

    在里面新建一个名为 index.html 的文件,在访问时 IP/test 就能访问到 该目录。

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Abin</title>
    </head>
    <body>
         My first web html...
         <br>
         Hello world, I am lilinyuan...
    </body>
    </html>

    重启apache服务

     sudo apache2ctl -k restart 

    访问

    5. 域名解析

     在阿里云,控制台的域名管理页面,配置域名与IP绑定。

    此时还不能通过域名访问网站,还需要进行ICP备案,提交各种资料等待完成即可。

    via

    Ubuntu 18.04下使用Apache搭建一个web服务器

     创建自己的个人网站(一)

  • 相关阅读:
    笔记-树形dp
    20181018 考试记录
    20181015 考试记录&数论
    [模板]2-SAT 问题&和平委员会
    FLask的偏函数应用
    Flask中的g到底是个什么鬼?
    Flask源码关于local的实现
    Flask的“中间件”
    Flask之模板
    FLask之视图
  • 原文地址:https://www.cnblogs.com/protogenoi/p/11100198.html
Copyright © 2011-2022 走看看