Linux-day10 使用Apache服务部署静态网站

Sqribble深度解析:轻量级文档操作系统架构与出版级排版原理 文档自动化工具正从‘格式美化器’演进为具备结构化处理能力的文档操作系统。其核心在于将内容、模板、布局规则与输出格式解耦,依托云原生架构实现DOM净化、语义重建与出版增强三重内容处理,并通过声明式模板引擎和确定性排版模型(如分页算法、层次权重矩阵)保障跨平台一致输出。这类系统不依赖AI生成内容,而是以工程化方式提升技术文档、知识产品与营销材料的交付效率与专业度,适用于内容运营、SaaS文档工程师及知识付费创作者等需高频产出PDF/EPUB等标准化出版物的场景。 阅读详情

Linux-day10 使用Apache服务部署静态网站


1.网站服务程序

  • 1970年,作为互联网前身的ARPANET(阿帕网)已初具雏形,并开始向非军用部门开放,许多大学和商业部门开始接入。虽然彼时阿帕网的规模(只有4台主机联网运行)还不如现在的局域网成熟,但是它依然为网络技术的进步打下了扎实的基础。

  • Web网络服务是一种被动访问的服务程序,即只有接收到互联网中其他主机发出的请求后才会响应,最终用于提供服务程序的Web服务器会通过HTTP(超文本传输协议)或HTTPS(安全超文本传输协议)把请求的内容传送给用户。

    10-1

  • 目前能够提供web网络服务的程序有IIS、Nginx和Apache

    • IIS(Internet Information Services,互联网信息服务) 是Windows系统中默认的web服务程序,这是一款图形化的网站管理工具,不仅可以提供web网站服务,还可以提供FTP、NMTP、SMTP等服务。
    • Nginx程序作为一款轻量级的网站服务软件,因其稳定性和丰富的功能而快速占领服务器市场,但Nginx最被认可的还当是系统资源消耗低且并发能力强
    • Apache程序是目前拥有很高市场占有率的Web服务程序之一,其跨平台和安全性广泛被认可且拥有快速、可靠、简单的API扩展。
    • Apache服务程序可以运行在Linux系统、UNIX系统甚至是Windows系统中,支持基于IP、域名及端口号的虚拟主机功能,支持多种认证方式,集成有代理服务器模块、安全Socket层(SSL),能够实时监视服务状态与定制日志消息,并有着各类丰富的模块支持。
  • Apache服务部署

    • 1.把光盘设备中的系统镜像挂载到/media/cdrom目录

        [root@localhost Desktop]# mkdir -p /media/cdrom
        [root@localhost Desktop]# mount /dev/cdrom /media/cdrom
        mount: /dev/sr0 is write-protected, mounting read-only
      
    • 2.使用Vim文本编辑器创建Yum仓库的配置文件

        [root@localhost Desktop]# vim /etc/yum.repos.d/rhel7.repo
        [rhel7]
        name=rhel7
        baseurl=file:///media/cdrom
        enable=1
        gpgcheck=0
        [root@localhost Desktop]# yum makecache
        Loaded plugins: langpacks, product-id, subscription-manager
        This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
        rhel7                         | 4.1 kB     00:00
        (1/5): rhel7/group_gz         | 134 kB     00:00
        (2/5): rhel7/primary_db       | 3.4 MB     00:00
        (3/5): rhel7/filelists_db     | 3.0 MB     00:00
        (4/5): rhel7/other_db         | 1.3 MB     00:00
        (5/5): rhel7/productid        | 1.6 kB     00:00
        Metadata Cache Created
      
    • 3.安装Apache服务程序。

        [root@localhost Desktop]# yum install httpd
        Loaded plugins: langpacks, product-id, subscription-manager
        This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
        Resolving Dependencies
        --> Running transaction check
        ---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed
        --> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64
        --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-17.el7.x86_64
        --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64
        --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64
        --> Running transaction check
        ---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
        ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
        ---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed
        ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
        --> Finished Dependency Resolution
      
        Dependencies Resolved
      
        ================================================================================
        Package             Arch           Version                 Repository     Size
        ================================================================================
        Installing:
        httpd               x86_64         2.4.6-17.el7            rhel7         1.2 M
        Installing for dependencies:
        apr                 x86_64         1.4.8-3.el7             rhel7         103 k
        apr-util            x86_64         1.5.2-6.el7             rhel7          92 k
        httpd-tools         x86_64         2.4.6-17.el7            rhel7          77 k
        mailcap             noarch         2.1.41-2.el7            rhel7          31 k
      
        Transaction Summary
        ================================================================================
        Install  1 Package (+4 Dependent packages)
      
        Total download size: 1.5 M
        Installed size: 4.3 M
        Is this ok [y/d/N]: y
        Downloading packages:
        --------------------------------------------------------------------------------
        Total                                              5.3 MB/s | 1.5 MB  00:00
        Running transaction check
        Running transaction test
        Transaction test succeeded
        Running transaction
        Installing : apr-1.4.8-3.el7.x86_64                                       1/5
        Installing : apr-util-1.5.2-6.el7.x86_64                                  2/5
        Installing : httpd-tools-2.4.6-17.el7.x86_64                              3/5
        Installing : mailcap-2.1.41-2.el7.noarch                                  4/5
        Installing : httpd-2.4.6-17.el7.x86_64                                    5/5
        Verifying  : mailcap-2.1.41-2.el7.noarch                                  1/5
        Verifying  : httpd-tools-2.4.6-17.el7.x86_64                              2/5
        Verifying  : apr-1.4.8-3.el7.x86_64                                       3/5
        Verifying  : apr-util-1.5.2-6.el7.x86_64                                  4/5
        Verifying  : httpd-2.4.6-17.el7.x86_64                                    5/5
      
        Installed:
        httpd.x86_64 0:2.4.6-17.el7
      
        Dependency Installed:
        apr.x86_64 0:1.4.8-3.el7                 apr-util.x86_64 0:1.5.2-6.el7
        httpd-tools.x86_64 0:2.4.6-17.el7        mailcap.noarch 0:2.1.41-2.el7
      
        Complete!
      
    • 4.启动httpd服务程序并将其加入到开机启动项中,使其能够随系统开机而运行,从而持续为用户提供web服务

        [root@localhost Desktop]# systemctl start httpd
        [root@localhost Desktop]# systemctl enable httpd
        ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
      
    • 5.通过firefox浏览器访问http://127.0.0.1,就可以看到httpd服务程序的默认页面

        [root@localhost Desktop]# firefox
      

      10-2

2.配置服务文件参数

  • 在Linux系统中的配置文件

    名称地址
    服务目录/etc/httpd
    主配置文件/etc/httpd/conf/httpd.conf
    网站数据目录/var/www/html
    访问日志/var/log/httpd/access_log
    错误日志/var/log/httpd/error_log
  • 在httpd服务程序的主配置文件,存在三种类型的信息:注释行信息、全局配置、区域配置

    10-4

    • 全局配置参数就是一种全局性的配置参数,可作用于对所有的子站点,既保证了子站点的正常访问,也有效减少了频繁写入重复参数的工作量。
    • 区域配置参数则是单独针对于每个独立的子站点进行设置的。
  • 在httpd服务程序主配置文件中,最为常用的参数:

    参数用途描述
    ServerRoot服务目录
    ServerAdmin管理员邮箱
    User运行服务的用户
    Group运行服务的用户组
    ServerName网站服务器的域名
    DcoumentRoot网站数据目录
    Listen监听的ip地址与端口号
    DirectoryIndex默认的索引页页面
    ErrorLog错误日志文件
    CustomLog访问日志文件
    Timeout网页超时时间,默认为300秒
  • DocumentRoot参数用于定义网站数据的保存路径,其参数的默认值是把网站数据存放到/var/www/html目录中,而当前网站普遍的首页面名称是index.html;

  • 范例

    • 更改/var/www/html目录中index.html,替换掉httpd服务程序的默认首页面,该操作会立即生效。

        [root@localhost Desktop]# echo "Welcome To herhan.com" > /var/www/html/index.html
        [root@localhost Desktop]# firefox
      

      10-4

    • 更改网站数据的目录为/home/wwwroot

      • 1.建立网站数据的保存目录,并创建首页文件。

          [root@localhost Desktop]# mkdir /home/wwwroot
          [root@localhost Desktop]# echo "The New Web Directory" > /home/wwwroot/index.html
        
      • 2.打开httpd服务程序的主配置文件,将约第119行用于定义网站数据保存路径的参数DocumentRoot修改为/home/wwwroot,同时还需要将约第124行用于定义目录权限的参数Directory后面的路径也修改为/home/wwwroot。配置文件修改完毕后即可保存并退出。

          114 #
          115 # DocumentRoot: The directory out of which you will serve your
          116 # documents. By default, all requests are taken from this directory, but
          117 # symbolic links and aliases may be used to point to other locations.
          118 #
          119 DocumentRoot "/home/wwwroot"
          120
          121 #
          122 # Relax access to content within /var/www.
          123 #
          124 <Directory "/var/www">
          125     AllowOverride None
          126     # Allow open access:
          127     Require all granted
          128 </Directory>
          129
          130 # Further relax access to the default document root:
          131 <Directory "/home/wwwroot">
          132     #
          133     # Possible values for the Options directive are "None", "All",
          134     # or any combination of:
          135     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
          136     #
          137     # Note that "MultiViews" must be named *explicitly* --- "Options All"
          138     # doesn't give it to you.
          139     #
          140     # The Options directive is both complicated and important.  Please see
          141     # http://httpd.apache.org/docs/2.4/mod/core.html#options
          142     # for more information.
          143     #
          144     Options Indexes FollowSymLinks
          145
          146     #
          147     # AllowOverride controls what directives may be placed in .htaccess files.
          148     # It can be "All", "None", or any combination of the keywords:
          149     #   Options FileInfo AuthConfig Limit
          150     #
          151     AllowOverride None
          152
          153     #
          154     # Controls who can get stuff from this server.
          155     #
          156     Require all granted
          157 </Directory>
        
      • 3.重新启动httpd服务程序并验证效果;按理来说,只有在网站的首页面文件不存在或者用户权限不足时,才显示httpd服务程序的默认首页面。发现页面中显示“Forbidden,You don't have permission to access /index.html on this server.”。

          [root@localhost Desktop]# systemctl restart httpd
          [root@localhost Desktop]# firefox
        

        10-5

3 SELinux安全子系统

  • SELinux(Security-Enhanced Linux)是美国国家安全局在Linux开源社区的帮助下开发的一个强制访问控制(MAC,Mandatory Access Control)的安全子系统。

  • RHEL 7系统使用SELinux技术的目的是为了让各个服务进程都受到约束,使其仅获取到本应获取的资源。

  • SELinux安全子系统就是为了杜绝此类情况而设计的,它能够从多方面监控违法行为:

    • 对服务程序的功能进行限制(SELinux域限制可以确保服务程序做不了出格的事情);
    • 对文件资源的访问限制(SELinux安全上下文确保文件资源只能被其所属的服务程序进行访问)
  • “SELinux域”和“SELinux安全上下文”称为是Linux系统中的双保险

  • SELinux服务有三种配置模式,具体如下:

    • enforcing:强制启用安全策略模式,将拦截服务的不合法请求。
    • permissive:遇到服务越权访问时,只发出警告而不强制拦截。
    • disabled:对于越权的行为不警告也不拦截。
  • SELinux服务的配置文件/etc/selinux/config

      # This file controls the state of SELinux on the system.
      # SELINUX= can take one of these three values:
      #     enforcing - SELinux security policy is enforced.
      #     permissive - SELinux prints warnings instead of enforcing.
      #     disabled - No SELinux policy is loaded.
      SELINUX=enforcing
      # SELINUXTYPE= can take one of these two values:
      #     targeted - Targeted processes are protected,
      #     minimum - Modification of targeted policy. Only selected processes are protected.
      #     mls - Multi Level Security protection.
      SELINUXTYPE=targeted
    
  • getenforce命令获得当前SELinux服务的运行模式

      [root@localhost Desktop]# getenforce
      Enforcing
    
  • setenforce [0|1]命令修改SELinux当前的运行模式(0为禁用,1为启用)。

    • 注意,这种修改只是临时的,在系统重启后就会失效:
      [root@localhost Desktop]# setenforce 0
      [root@localhost Desktop]# getenforce
      Permissive
      [root@localhost Desktop]# firefox
    

    10-6

  • 前面的操作中到底是哪里出问题了呢?

    • httpd服务程序的功能是允许用户访问网站内容,因此SELinux肯定会默认放行用户对网站的请求操作。但是,我们将网站数据的默认保存目录修改为了/home/wwwroot,而这就产生问题了。/home目录是用来存放普通用户的家目录数据的,而现在,httpd提供的网站服务却要去获取普通用户家目录中的数据了,这显然违反了SELinux的监管原则。
  • SELinux安全上下文

    • 把SELinux服务恢复到强制启用安全策略模式,然后分别查看原始网站数据的保存目录与当前网站数据的保存目录是否拥有不同的SELinux安全上下文值:

        [root@localhost Desktop]# setenforce 1
        [root@localhost Desktop]# ls -Zd /var/www/html
        drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html
        [root@localhost Desktop]# ls -Zd /home/wwwroot
        drwxr-xr-x. root root unconfined_u:object_r:home_root_t:s0 /home/wwwroot
      
    • 在文件上设置的SELinux安全上下文是由用户段、角色段以及类型段等多个信息项共同组成的。其中,用户段system_u代表系统进程的身份,角色段object_r代表文件目录的角色,类型段httpd_sys_content_t代表网站服务的系统文件。

    • semanage命令

      • 用于管理SELinux的策略

      • 不仅能够像传统chcon命令那样—设置文件、目录的策略,还可以管理网络端口、消息接口

      • 格式为“semanage [选项][文件]”

      • 参数:

        • -l:用于查询;
        • -a:用于添加;
        • -m:用于修改;
        • -d:用于删除;
      • 范例:可以向新的网站数据目录中新添加一条SELinux安全上下文,让这个目录以及里面的所有文件能够被httpd服务程序所访问到

          [root@localhost Desktop]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot
          [root@localhost Desktop]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/*
        
    • restorecon命令将设置好的SELinux安全上下文立即生效。

      • -Rv参数对指定的目录进行递归操作,以及显示SELinux安全上下文的修改过程。

      • 范例:使上述配置生效,再次刷新页面,就可以正常看到网页内容了

          [root@localhost Desktop]# restorecon -Rv /home/wwwroot
          restorecon reset /home/wwwroot context unconfined_u:object_r:home_root_t:s0->unconfined_u:object_r:httpd_sys_content_t:s0
          restorecon reset /home/wwwroot/index.html context unconfined_u:object_r:home_root_t:s0->unconfined_u:object_r:httpd_sys_content_t:s0
        

4.个人用户主页功能

  • httpd服务程序提供的个人用户主页功能完全可以胜任这个工作。该功能可以让系统内所有的用户在自己的家目录中管理个人的网站,而且访问起来也非常容易。

  • 部署个人用户主页功能

    • 1.在httpd服务程序中,默认没有开启个人用户主页功能。我们需要编辑/etc/httpd/conf.d/userdir.conf配置文件,然后在第17行的UserDir disabled参数前面加上井号(#),表示让httpd服务程序开启个人用户主页功能;同时再把第24行的UserDir public_html参数前面的井号(#)去掉(UserDir参数表示网站数据在用户家目录中的保存目录名称,即public_html目录)。

        [root@localhost Desktop]# vim /etc/httpd/conf.d/userdir.conf
        # UserDir: The name of the directory that is appended onto a user's home
        # directory if a ~user request is received.
        #
        # The path to the end user account 'public_html' directory must be
        # accessible to the webserver userid.  This usually means that ~userid
        # must have permissions of 711, ~userid/public_html must have permissions
        # of 755, and documents contained therein must be world-readable.
        # Otherwise, the client will only receive a "403 Forbidden" message.
        #
        <IfModule mod_userdir.c>
            #
            # UserDir is disabled by default since it can confirm the presence
            # of a username on the system (depending on home directory
            # permissions).
            #
            #UserDir disabled
      
            #
            # To enable requests to /~user/ to serve the user's public_html
            # directory, remove the "UserDir disabled" line above, and uncomment
            # the following line instead:
            # 
            UserDir public_html
        </IfModule>
      
        #
        # Control access to UserDir directories.  The following is an example
        # for a site where these directories are restricted to read-only.
        #
        <Directory "/home/*/public_html">
            AllowOverride FileInfo AuthConfig Limit Indexes
            Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
            Require method GET POST OPTIONS
        </Directory>
        [root@localhost Desktop]# systemctl restart httpd
      
    • 2.在用户家目录中建立用于保存网站数据的目录及首页面文件。另外,还需要把家目录的权限修改为755,保证其他人也有权限读取里面的内容。

        [root@localhost Desktop]# su - herhan
        Last login: Sat Apr 11 18:26:37 CST 2020 on :0
        [herhan@localhost ~]$ mkdir public_html
        [herhan@localhost ~]$ echo "This is herhan's website" > public_html/index.html
        [herhan@localhost ~]$ chmod -R 755 /home/herhan
      
    • 3.重新启动httpd服务程序,在浏览器的地址栏中输入网址,其格式为“网址/~用户名”(其中的波浪号是必需的,而且网址、波浪号、用户名之间没有空格),从理论上来讲就可以看到用户的个人网站了。不出所料的是,系统显示报错页面,这一定还是SELinux惹的祸。

      10-7

    • 4.思考这次报错的原因是什么。httpd服务程序在提供个人用户主页功能时,该用户的网站数据目录本身就应该是存放到与这位用户对应的家目录中的,所以应该不需要修改家目录的SELinux安全上下文。但是,前文还讲到了SELinux域的概念。SELinux域确保服务程序不能执行违规的操作,只能本本分分地为用户提供服务。httpd服务中突然开启的这项个人用户主页功能到底有没有被SELinux域默认允许呢?

      • getsebool命令查询并过滤出所有与HTTP协议相关的安全策略。

        • 其中,off为禁止状态,on为允许状态。
        • 开启httpd服务的个人用户主页功能,用到的SELinux域安全策略应该是httpd_enable_homedirs吧
          [root@localhost Desktop]# getsebool -a | grep http
          httpd_anon_write --> off
          httpd_builtin_scripting --> on
          httpd_can_check_spam --> off
          httpd_can_connect_ftp --> off
          httpd_can_connect_ldap --> off
          httpd_can_connect_mythtv --> off
          httpd_can_connect_zabbix --> off
          httpd_can_network_connect --> off
          httpd_can_network_connect_cobbler --> off
          httpd_can_network_connect_db --> off
          httpd_can_network_memcache --> off
          httpd_can_network_relay --> off
          httpd_can_sendmail --> off
          httpd_dbus_avahi --> off
          httpd_dbus_sssd --> off
          httpd_dontaudit_search_dirs --> off
          httpd_enable_cgi --> on
          httpd_enable_ftp_server --> off
          httpd_enable_homedirs --> off
          httpd_execmem --> off
          httpd_graceful_shutdown --> on
          httpd_manage_ipa --> off
          httpd_mod_auth_ntlm_winbind --> off
          httpd_mod_auth_pam --> off
          httpd_read_user_content --> off
          httpd_run_stickshift --> off
          httpd_serve_cobbler_files --> off
          httpd_setrlimit --> off
          httpd_ssi_exec --> off
          httpd_sys_script_anon_write --> off
          httpd_tmp_exec --> off
          httpd_tty_comm --> off
          httpd_unified --> off
          httpd_use_cifs --> off
          httpd_use_fusefs --> off
          httpd_use_gpg --> off
          httpd_use_nfs --> off
          httpd_use_openstack --> off
          httpd_use_sasl --> off
          httpd_verify_dns --> off
          named_tcp_bind_http_port --> off
          prosody_bind_http_port --> off
        
      • setsebool命令来修改SELinux策略中各条规则的布尔值,

        • 参数:-P 让修改后的SELinux策略规则永久生效且立即生效。
          [root@localhost Desktop]# setsebool -P httpd_enable_homedirs=on
        

        10-8

  • 网站的拥有者并不希望直接将网页内容显示出来,只想让通过身份验证的用户访客看到里面的内容.

  • 网站中添加口令功能

    • 1.使用htpasswd命令生成密码数据库。

      • -c参数表示第一次生成;后面再分别添加密码数据库的存放文件,以及验证要用到的用户名称(该用户不必是系统中已有的本地账户)。
        [root@localhost public_html]# htpasswd -c /etc/httpd/passwd herhan
        New password: 此处输入用于网页验证的密码
        Re-type new password: 再输入一遍进行确认
        Adding password for user herhan
      
    • 2.编辑个人用户主页功能的配置文件。把第31~35行的参数信息修改成下列内容,随后保存并退出配置文件,重启httpd服务程序即可生效。

        [root@localhost public_html]# vim /etc/httpd/conf.d/userdir.conf
        27 #
        28 # Control access to UserDir directories.  The following is an example
        29 # for a site where these directories are restricted to read-only.
        30 #
        31 <Directory "/home/*/public_html">
        32     AllowOverride all
        #刚刚生成出来的密码验证文件保存路径
        33     authuserfile "/etc/httpd/passwd"
        #当用户尝试访问个人用户网站时的提示信息
        34     authname "My privately website"
        35     authtype basic
        #用户进行账户密码登录时需要验证的用户名称
        36     Require user herhan
        37 </Directory>
        [root@localhost public_html]# systemctl restart httpd
      
    • 3.当用户再想访问某个用户的个人网站时,就必须要输入账户和密码才能正常访问了。验证时使用的账户和密码是用htpasswd命令生成的专门用于网站登录的口令密码,而不是系统中的用户密码。

      10-9

5.虚拟网站主机功能

  • 虚拟主机功能,可以把一台处于运行状态的物理服务器分割成多个“虚拟的服务器”。但是,该技术无法实现目前云主机技术的硬件资源隔离,让这些虚拟的服务器共同使用物理服务器的硬件资源,供应商只能限制硬盘的使用空间大小。

  • Apache的虚拟主机功能是服务器基于用户请求的不同IP地址、主机域名或端口号,实现提供多个网站同时为外部提供访问服务的技术,用户请求的资源不同,最终获取到的网页内容也各不相同。

    10-10

5.1 基于ip地址

  • 部署基于ip地址的虚拟主机
    • 1.分别在/home/wwwroot中创建用于保存不同网站数据的3个目录,并向其中分别写入网站的首页文件。每个首页文件中应有明确区分不同网站内容的信息,方便我们稍后能更直观地检查效果。

        [root@localhost public_html]# mkdir /home/wwwroot/10
        [root@localhost public_html]# mkdir /home/wwwroot/20
        [root@localhost public_html]# mkdir /home/wwwroot/30
        [root@localhost public_html]# echo "IP:192.168.10.10" > /home/wwwroot/10/index.html
        [root@localhost public_html]# echo "IP:192.168.10.20" > /home/wwwroot/20/index.html
        [root@localhost public_html]# echo "IP:192.168.10.30" > /home/wwwroot/30/index.html
      
    • 2.在httpd服务的配置文件中大约113行处开始,分别追加写入三个基于IP地址的虚拟主机网站参数,然后保存并退出。记得需要重启httpd服务,这些配置才生效。

        [root@localhost public_html]# vim /etc/httpd/conf/httpd.conf
        113 #
        114 <VirtualHost 192.168.10.10>
        115 DocumentRoot "/home/wwwroot/10"
        116 ServerName www.herhan.com
        117 <Directory /home/wwwroot/10>
        118 AllowOverride None
        119 Require all granted
        120 </Directory>
        121 </VirtualHost>
        122
        123 <VirtualHost 192.168.10.20>
        124 DocumentRoot "/home/wwwroot/20"
        125 ServerName bbs.herhan.com
        126 <Directory /home/wwwroot/20>
        127 AllowOverride None
        128 Require all granted
        129 </Directory>
        130 </VirtualHost>
        131 <VirtualHost 192.168.10.30>
        132 DocumentRoot "/home/wwwroot/30"
        133 ServerName tech.herhan.com
        134 <Directory /home/wwwroot/30>
        135 AllowOverride None
        136 Require all granted
        137 </Directory>
        138 </VirtualHost>
        [root@localhost public_html]# systemctl restart http
      
    • 3.此时访问网站,则会看到httpd服务程序的默认首页面。由于当前的/home/wwwroot目录及里面的网站数据目录的SELinux安全上下文与网站服务不吻合,因此httpd服务程序无法获取到这些网站数据目录。

        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/10
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/10/*
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/20
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/20/*
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/30
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/30/*
        [root@localhost public_html]# restorecon -Rv /home/wwwroot
      

      10-11

5.2 基于主机域名

  • 当服务器无法为每个网站都分配一个独立IP地址的时候,可以尝试让Apache自动识别用户请求的域名,从而根据不同的域名请求来传输不同的内容。

  • 部署基于主机域名的虚拟主机

    • 1.手工定义IP地址与域名之间对应关系的配置文件,保存并退出后会立即生效。可以通过分别ping这些域名来验证域名是否已经成功解析为IP地址.

        [root@localhost public_html]# vim /etc/hosts
        127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
        ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
        192.168.10.10 www.herhan.com bbs.herhan.com tech.herhan.com
        [root@localhost public_html]# ping www.herhan.com
        PING www.herhan.com (192.168.10.10) 56(84) bytes of data.
        64 bytes from www.herhan.com (192.168.10.10): icmp_seq=1 ttl=64 time=0.037 ms
        64 bytes from www.herhan.com (192.168.10.10): icmp_seq=2 ttl=64 time=0.040 ms
        64 bytes from www.herhan.com (192.168.10.10): icmp_seq=3 ttl=64 time=0.041 ms
        64 bytes from www.herhan.com (192.168.10.10): icmp_seq=4 ttl=64 time=0.040 ms
      
    • 2.分别在/home/wwwroot中创建用于保存不同网站数据的三个目录,并向其中分别写入网站的首页文件。每个首页文件中应有明确区分不同网站内容的信息,方便我们稍后能更直观地检查效果。

        [root@localhost public_html]# mkdir /home/wwwroot/www
        [root@localhost public_html]# mkdir /home/wwwroot/bbs
        [root@localhost public_html]# mkdir /home/wwwroot/tech
        [root@localhost public_html]# echo "www.herhan.com" > /home/wwwroot/www/index.html
        [root@localhost public_html]# echo "bbs.herhan.com" > /home/wwwroot/bbs/index.html
        [root@localhost public_html]# echo "tech.herhan.com" > /home/wwwroot/tech/index.html
      
    • 3.在httpd服务的配置文件中大约113行处开始,分别追加写入三个基于主机名的虚拟主机网站参数,然后保存并退出。记得需要重启httpd服务,这些配置才生效。

        [root@localhost public_html]# vim /etc/httpd/conf/httpd.conf
        <VirtualHost 192.168.10.10>
        DocumentRoot "/home/wwwroot/www"
        ServerName "www.herhan.com"
        <Directory /home/wwwroot/www>
        AllowOverride None
        Require all granted
        </Directory>
        </VirtualHost>
      
        <VirtualHost 192.168.10.10>
        DocumentRoot "/home/wwwroot/bbs"
        ServerName "bbs.herhan.com"
        <Directory /home/wwwroot/bbs>
        AllowOverride None
        Require all granted
        </Directory>
        </VirtualHost>
      
        <VirtualHost 192.168.10.10>
        DocumentRoot "/home/wwwroot/tech"
        ServerName "tech.herhan.com"
        <Directory /home/wwwroot/tech>
        AllowOverride None
        Require all granted
        </Directory>
        </VirtualHost>
      
    • 4.因为当前的网站数据目录还是在/home/wwwroot目录中,因此还是必须要正确设置网站数据目录文件的SELinux安全上下文,使其与网站服务功能相吻合。最后记得用restorecon命令让新配置的SELinux安全上下文立即生效,这样就可以立即访问到虚拟主机网站了。

        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/www
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/www/*
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/bbs/*
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/bbs
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/tech
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/tech/*
        [root@localhost public_html]# restorecon /home/wwwroot
      

      10-12

5.3 基于端口号

  • 基于端口号的虚拟主机功能可以让用户通过指定的端口号来访问服务器上的网站资源。在使用Apache配置虚拟网站主机功能时,基于端口号的配置方式是最复杂的。

  • 部署基于主机域名的虚拟主机

    • 不但要考虑到目录上应用的SELinux安全上下文的限制,还需要考虑SELinux域对httpd服务程序的管控。

    • 1.分别在/home/wwwroot中创建用于保存不同网站数据的两个目录,并向其中分别写入网站的首页文件。每个首页文件中应有明确区分不同网站内容的信息,方便我们稍后能更直观地检查效果。

        [root@localhost public_html]# mkdir -p /home/wwwroot/6111
        [root@localhost public_html]# mkdir -p /home/wwwroot/6222
        [root@localhost public_html]# echo "port:6111" > /home/wwwroot/6111/index.hmtl
        [root@localhost public_html]# echo "port:6222" > /home/wwwroot/6222/index.hmtl
      
    • 2.在httpd服务配置文件的第43行和第44行分别添加用于监听6111和6222端口的参数。

        [root@localhost public_html]# vim /etc/httpd/conf/httpd.conf
        33 #
        34 # Listen: Allows you to bind Apache to specific IP addresses and/or
        35 # ports, instead of the default. See also the <VirtualHost>
        36 # directive.
        37 #
        38 # Change this to Listen on specific IP addresses as shown below to 
        39 # prevent Apache from glomming onto all bound IP addresses.
        40 #
        41 #Listen 12.34.56.78:80
        42 Listen 80
        43 Listen 6111
        44 Listen 6222
      
      
    • 3.在httpd服务的配置文件中大约113行处开始,分别追加写入两个基于端口号的虚拟主机网站参数,然后保存并退出。记得需要重启httpd服务,这些配置才生效。

        [root@localhost public_html]# vim /etc/httpd/conf/httpd.conf
        114 #
        115 <VirtualHost 192.168.10.10:6111>
        116 DocumentRoot "/home/wwwroot/6111"
        117 ServerName www.herhan.com
        118 <Directory /home/wwwroot/6111>
        119 AllowOverride None
        120 Require all granted
        121 </Directory>
        122 </VirtualHost>
        123 
        124 <VirtualHost 192.168.10.10:6222>
        125 DocumentRoot "/home/wwwroot/6222"
        126 ServerName bbs.herhan.com
        127 <Directory /home/wwwroot/6222>
        128 AllowOverride None
        129 Require all granted
        130 </Directory>
        131 </VirtualHost>
        [root@localhost public_html]# systemctl restart httpd.service
        Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
        [root@localhost public_html]# systemctl status httpd.service 
        httpd.service - The Apache HTTP Server
          Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
          Active: failed (Result: exit-code) since Sun 2020-04-19 18:26:16 CST; 12s ago
          Process: 17719 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
          Process: 17717 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
        Main PID: 17717 (code=exited, status=1/FAILURE)
          Status: "Total requests: 8; Current requests/sec: 0; Current traffic:   0 B/sec"
      
        Apr 19 18:26:16 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
        Apr 19 18:26:16 localhost.localdomain httpd[17717]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the...his message
        Apr 19 18:26:16 localhost.localdomain httpd[17717]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:6111
        Apr 19 18:26:16 localhost.localdomain httpd[17717]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:6111
        Apr 19 18:26:16 localhost.localdomain httpd[17717]: no listening sockets available, shutting down
        Apr 19 18:26:16 localhost.localdomain httpd[17717]: AH00015: Unable to open logs
        Apr 19 18:26:16 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
        Apr 19 18:26:16 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
        Apr 19 18:26:16 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
        Hint: Some lines were ellipsized, use -l to show in full.
      
      
    • 4.重启httpd服务后,竟然出现报错信息。这是因为SELinux服务检测到6111和6222端口原本不属于Apache服务应该需要的资源,但现在却以httpd服务程序的名义监听使用了,所以SELinux会拒绝使用Apache服务使用这两个端口。

        [root@localhost public_html]# semanage port -l|grep http
        http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010
        http_cache_port_t              udp      3130
        http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
        pegasus_http_port_t            tcp      5988
        pegasus_https_port_t           tcp      5989
      
    • 5.SELinux允许的与HTTP协议相关的端口号中默认没有包含6111和6222,因此需要将这两个端口号手动添加进去。该操作会立即生效,而且在系统重启过后依然有效。

        [root@localhost public_html]# semanage port -a -t http_port_t -p tcp 6111
        [root@localhost public_html]# semanage port -a -t http_port_t -p tcp 6222
        [root@localhost public_html]# semanage port -l|grep http
        http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010
        http_cache_port_t              udp      3130
        http_port_t                    tcp      6222, 6111, 80, 81, 443, 488, 8008, 8009, 8443, 9000
        pegasus_http_port_t            tcp      5988
        pegasus_https_port_t           tcp      5989
        [root@localhost public_html]# systemctl restart httpd.service 
      
    • 6.因为我们把网站数据目录存放在/home/wwwroot目录中,因此还是必须要正确设置网站数据目录文件的SELinux安全上下文,使其与网站服务功能相吻合。最后记得用restorecon命令让新配置的SELinux安全上下文立即生效。

        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6111
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6222
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6111/*
        [root@localhost public_html]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6222/*
        [root@localhost public_html]# restorecon /home/wwwroot
      

      10-13

6.Apache的访问控制

  • Apache可以基于源主机名、源IP地址或源主机上的浏览器特征等信息对网站上的资源进行访问控制。

  • 通过Allow指令允许某个主机访问服务器上的网站资源,

  • 通过Deny指令实现禁止访问。

  • 在允许或禁止访问网站资源时,还会用到Order指令,这个指令用来定义Allow或Deny指令起作用的顺序,其匹配原则是按照顺序进行匹配,若匹配成功则执行后面的默认指令。

  • “Order Allow, Deny”表示先将源主机与允许规则进行匹配,若匹配成功则允许访问请求,反之则拒绝访问请求。

  • 范例:Apache的访问控制演示

    • 1.先在服务器上的网站数据目录中新建一个子目录,并在这个子目录中创建一个包含Successful单词的首页文件。

        [root@localhost public_html]# mkdir /var/www/html/server
        [root@localhost public_html]# echo "Successful" > /var/www/html/server/index.html
      
    • 2.打开httpd服务的配置文件,在第129行后面添加下述规则来限制源主机的访问。这段规则的含义是允许使用Firefox浏览器的主机访问服务器上的首页文件,除此之外的所有请求都将被拒绝。

        [root@localhost public_html]# vim /etc/httpd/conf/httpd.conf
        #
        <Directory /var/www/html/server>
        SetEnvIf User-Agent "Firefox" ff=1
        Order allow,deny
        Allow from env=ff
        </Directory>
        #
        [root@localhost public_html]# systemctl restart httpd.service
      

      10-14

    • 3.除了匹配源主机的浏览器特征之外,还可以通过匹配源主机的IP地址进行访问控制。例如,我们只允许IP地址为192.168.10.20的主机访问网站资源,那么就可以在httpd服务配置文件的第129行后面添加下述规则。

        [root@localhost public_html]# vim /etc/httpd/conf/httpd.conf
        #
        <Directory /var/www/html/server>
        Order allow,deny
        Allow from 192.168.10.20
        </Directory>
        #
        [root@localhost public_html]# systemctl restart httpd.service
      

      10-15

【信息科学与工程学】【数据中心】 第十篇 智算中心存储系统的各类、分片方案 简单性原则:在满足需求的前提下,选择最简单的架构和实现可扩展性原则:设计应考虑水平扩展能力,避免单点瓶颈韧性原则:系统应具备故障容忍和自我修复能力安全性原则:安全应内置而非外挂,遵循最小权限原则成本效益原则:在性能和成本之间寻求最佳平衡可观测性原则:系统应提供充分的监控和诊断能力演进性原则:设计应支持平滑演进和技术更新架构先行:设计前瞻性、可扩展的存储网络架构性能与成本平衡:在性能、可靠性和成本之间找到最优平衡点安全合规内嵌:将安全和合规要求融入设计和实施全过程自动化智能化。 阅读详情

相关推荐

Linux--使用Apache服务部署静态网站

目录:网站服务程序​二、配置服务文件参数​三、SELinux安全子系统四、个人用户主页功能​五、虚拟网站主机功能六、Apache的访问控制致谢Web网络服务是一种被动访问的服务程序,即只有接收到互联网中其他主机发出的请求后才会响应,最终用于提供服务程序的Web服务器会通过HTTP(超文本传输协议)或HTTPS(安全超文本传输协议)把请求的内容传送给客户。目前能够提供Web网络服务的程序有IIS、Nginx和Apache等、IIS(Internet Information Sevices,互联网信息服务)是

恐龙让Lee的博客 3812

shell练习---apache服务部署静态网站

【代码】shell练习---apache服务部署静态网站。

weixin_53308294的博客 187

实测有效防止colab自动断开连接

实测有效防止colab自动断开连接

Thebest_jack的博客 1万+

Apache之搭建静态网站

一:安装Apache (1)安装 yum -y install httpd (2)启动 systemctl start httpd (3)查看服务状态 systemctl status httpd (4)设置开机自启 systemctl enable httpd (5)关闭防火墙 (查看:systemctl status firewalld) systemctl stop firewalld(临时关闭) systemctl disable firewalld(永久关闭) (6)关闭selinux(查

Cat God 007的博客 3758

别再只会调速度了!用STM32的定时器中断精准控制伺服电机转角(避坑指南)

本文详细介绍了如何利用STM32的定时器中断和PWM输出实现伺服电机的精准转角控制,避免常见的速度控制误区。通过硬件配置、脉冲计数逻辑和优化技巧的实战讲解,帮助开发者掌握高精度位置控制方法,适用于工业自动化和机器人控制等场景。

weixin_42531163的博客 411

Mplus—交叉滞后面板模型(Cross-Lagged Panel Model, CLPM)

本文介绍交叉滞后模型相关知识,以及显变量模型与潜变量模型在Mplus中的语法。

m0_54401011的博客 1万+

使用Apache搭建网站

1.编译安装httpd 2.优化路径 3.并将鲜花网站上传到web服务器为网页目录(当然其他网站源码也可以) 4.在客户机上使用域名进行访问

敬故的博客 4727

SAP FICO 资产会计AA后台配置 (上)

输入折旧表“CZ11”如有外币计价的资产,则需指定外币计价的资产折旧范围,以及规则。因为在设置资产类型时,需指定一个对应的 资产编号范围、资产账户确定类型(便于分配自动会计科目)、屏幕格式规则(便于设置资产字段必填与否)。因为在设置资产类型时,需指定一个对应的 资产编号范围、资产账户确定类型(便于分配自动会计科目)、屏幕格式规则(便于设置资产字段必填与否)。新增资产类型:Z101 固定资产-房屋及建筑物新增资产类型:Z301 固定资产-房屋及建筑物。

ghgxm520的博客 1756

第九章 使用Apache服务部署静态网站

1970 年,作为互联网前身的 ARPANET(阿帕网)已初具雏形,并开始向非军用部门开放,许多大学和商业机构开始陆续接入。虽然彼时阿帕网的规模(只有 4 台主机联网运行)还不如现在的局域网成熟,但是它依然为网络技术的进步打下了扎实的基础。想必大多数人都是通过访问网站而开始接触互联网的吧。我们平时访问的网站服务就是Web 网络服务,一般是指允许用户通过浏览器访问互联网中各种资源的服务。如图所示,

u012616827的博客 2882

华为2288H V5服务器断电后‘趴窝’?别慌,手把手教你用SmartKit+BMC修复工具搞定

本文详细介绍了华为2288H V5服务器在断电后无法启动的修复方法,通过SmartKit和BMC修复工具进行故障诊断与修复。文章提供了从工具获取、安装到具体修复流程的完整指南,帮助运维人员快速恢复服务器运行,并给出了后续加固与预防措施,确保服务器稳定运行。

weixin_30575517的博客 289

【小白深度教程 1.3】使用 BP-Net 深度补全网络,进行 KITTI 稠密点云和图像融合(Depth Completion 实战)

在上一节中,我们展示了如何将从激光雷达获取的稀疏点云(深度)映射到图像。因此这篇论文我们尝试使用 Depth Completion(深度补全)技术,来将稀释的点云深度,补全为稠密深度。

2401_87064292的博客 1195

Linux实验记录:使用Apache服务部署静态网站

本文是一篇关于Linux系统初学者的实验记录。参考书籍:《Linux就该这么学》实验环境:虚拟机软件RedHatEnterpriseLinux[RHEL]8——红帽操作系统目录实验1:安装Apache程序Step1:把系统镜像挂载到/media/cdrom目录Step2:使用Vim文本编辑器创建软件仓库的配置文件Step3:安装Apache服务程序Step4:启用httpd服务程序并将其加入到开机启动项实验2:配置服务参数文件:修改保存网站数据的目录Step1:建立网站数据的保存目录,并创建首页文件。

d3535的博客 2991

破晓之光:GTK#框架让C# WinForm程序跨平台运行的终极指南

GTK#框架的出现,彻底打破了C# WinForm只能在Windows上运行的桎梏。

墨夶的博客 598

Linux学习总结day10-使用Apache部署静态网站

十一、使用Apache部署静态网站 1.web网站服务又称为www服务 2.Web服务原理 是一种被动服务,只有接收了互联网中其它计算机发出的请求后才会响应,然后web服务器才会使用HTTP或HTTPS奖指定文件传送到客户机的浏览器上解析后成为网页。 3.常见的web服务程序 (1)IIS7: Internet Information Service 7,是windows系统中默认web服务程...

qq_43266440的博客 659

rk3576 点亮 LCD(eDP)

RK3576 处理器集成了对 **eDP (Embedded DisplayPort)** 接口的支持,主要用于驱动嵌入式或笔记本电脑的内置屏幕。支持 **eDP 1.3 版本协议**, 最大可支持 ****4K@120Hz**。

weixin_35723192的博客 344

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

《Linux就该这么学》day1-day2

ps:原谅我的书法出自鲁迅的《野草》 《Linux就该这么学》书本介绍: 本书是由全国多名红帽架构师(RHCA)基于最新Linux系统共同编写的高质量Linux技术自学教程,极其适合用于Linux技术入门教程或讲课辅助教材,目前是国内最值得去读的Linux教材,也是最有价值的Linux实验手册。章节包括有: 第0章 咱们先来谈谈学习方法和红帽系统。 第1章 部署虚拟环境...

183

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

myshare 4.linux软件安装与java开发环境搭建&静态网站制作

Day 04 2.7软件安装 2.7.1、rpm软件包的管理 mkdir /iso     //在/目录下新建一个iso目录 mount /dev/sr0 /iso //把/dev/sr0挂载在/iso下 df -h //查看挂载情况 cd /iso/Packages //进入Packages目录 find *telnet* //搜索含有telnet字符的文件 rpm -ivh t

qq_35556474的博客 641

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

《Linux就该这么学》day3

ps:原谅我的书法出自鲁迅的《野草》 《Linux就该这么学》书本介绍: 本书是由全国多名红帽架构师(RHCA)基于最新Linux系统共同编写的高质量Linux技术自学教程,极其适合用于Linux技术入门教程或讲课辅助教材,目前是国内最值得去读的Linux教材,也是最有价值的Linux实验手册。章节包括有: 第0章 咱们先来谈谈学习方法和红帽系统。 第1章 部署虚拟环境...

149

# Linux实战笔记:WordPress文创项目部署全流程记录

WordPress是一款开源免费 PHP+MySQL架构的内容管理系统(CMS,Content Management System),2003 年正式发布,基于 GPLv2 开源协议,任何人都可免费使用、修改、二次开发、商用,无需授权费。核心定位:快速搭建各类网站,无需大量代码基础,是全球占有率最高的建站程序,全球超 43% 网站基于 WordPress 搭建。WordPress可演变成为:博客、企业官网、商城、资讯门户、课程网站、作品集、下载站等,需要程序员二次开发。

weixin_46136019的博客 447

Ubuntu 14.04 + Hexo 静态博客搭建实战指南

静态网站生成器是现代轻量级内容发布的基石,其核心原理在于将 Markdown 等源文件通过模板引擎离线编译为纯 HTML/CSS/JS,无需后端服务或数据库。这一技术路径天然具备高性能、高安全性与强可移植性,特别适合教学环境、老旧服务器及边缘设备等资源受限场景。Hexo 作为 Node.js 生态中成熟稳定的代表,与 Ubuntu 14.04 这类长期冻结依赖的 LTS 系统形成精准匹配——前者不依赖运行时框架,后者提供确定性系统环境,二者协同构建出从写作、生成、版本控制(Git)到部署(Nginx)的端到

weixin_30435261的博客 358

Python爬虫与数据分析实战:从数据采集到自动化工作流构建

在数据驱动的时代,掌握高效的数据获取与分析能力已成为一项核心技能。其原理在于通过自动化工具将非结构化信息转化为结构化数据,进而提取有价值的信息洞察。这一技术价值体现在能够显著提升工作效率,替代重复性手动劳动,并为决策提供数据支持。应用场景广泛覆盖市场调研、竞品分析、舆情监控、业务报表自动化等多个领域。本文聚焦于Python生态中的核心工具链,详细拆解了如何利用Requests、BeautifulSoup、Selenium等库构建稳健的爬虫数据管道,并衔接Pandas、Matplotlib等工具进行数据清洗、

weixin_33695082的博客 271

Linux学习之十【使用Apache 服务部署静态网站】

整理自刘遄老师的《Linux就该这么学》,网站链接 文章目录整理自刘遄老师的《Linux就该这么学》,[网站链接](https://www.linuxprobe.com/)10、使用Apache 服务部署静态网站10.1 网站服务程序部署Apache服务程序:10.2 配置服务文件参数10.3 SELinux安全子系统1、semanage命令10.4 个人用户主页功能10.5 虚拟主机功能1、基于...

weixin_44761910的博客 717

LInux基础--apache部署网站

apache的使用

qq_63781342的博客 648

Apache服务部署静态网站

Apache服务部署静态网站 (一)网站服务程序 1,http:超文本传输协议 2,https: 安全超文本传输协议 3,网站服务程序,典型的被动应用程序(请求和相应) 4,默认监听端口:80 5,Nginx ,iis(只能运行在windows 操作系统 ),apache(在市场占有率最高) 6,LAMP ,LNMP 7,用户请求的常用两种:get 和post (二)配置yum 源 mkdi...

weixin_39846205的博客 548

使用Apache部署静态网站

【代码】使用Apache部署静态网站。

itxuchuanlong的博客 1822

使用Apache服务部署静态网站

安装httpd 配置服务文件参数 linux系统中的配置文件 在httpd服务的主配置文件中存在三种类型的信息:注释信息、全局配置、区域配置 配置httpd服务程序时最常用的参数以及用途描述 修改httpd服务程序保存的数据目录 第一步:建立网站数据的保存目录,并创建首页文件 第二步:修改主配置文件 第三步:重启httpd服务 个人用户主页功能 第一步:进入/etc/httpd/conf.d/userdir.conf 文件下 第二步:创建用户,并在用户家目录中建立用户保

weixin_55778488的博客 1129
上一篇: Linux_day7 使用RAID与LVM磁盘阵列技术
下一篇: Rust 介绍 -- Day1
胖可仃
博客等级 码龄10年 6粉丝 23原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值