温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

http2

发布时间:2020-03-01 14:39:09 来源:网络 阅读:436 作者:Taxing祥 栏目:网络安全

1.http访问权限

cd /var/www/

mkdir taxing#selinux 为强制状态时需要此步骤,关闭则不需要

semanage frcontext -a -t http_sys_content_t '/www/taxing(/.*)?'

restorecon -RccF /www/

ls -Zd .

 

vim /etc/httpd/conf/httpd.conf

119 #DocumentRoot "/var/www/html"#修改访问默认目录

120 DocumentRoot "/var/www/taxing"

121 <Directory "/var/www/taxing">

122         require all granted#开放对所有人的访问权限

123         Order Allow,Deny#读取顺序

124         Allow from ALL#允许对所有人

125         Deny from 172.25.254.24#拒绝172.25.254.24对httpd的访问

126 </Directory>

 

170     DirectoryIndex timo index.html#访问文件 (172.25.254.124/timo)(172.25.254.124)

 

42 Listen 80#8080#访问端口(172.25.254.124)(172.25.254.124:8080)

 

ctrl+shift+Delete#清除缓存

2.密码登陆

cd /etc/httpd/

htpasswd -cm htpasswdfile timo#创建用户和密码

htpasswd -m htpasswdfile rito#添加用户和密码

[root@timo httpd]# cat htpasswdfile

timo:$apr1$jUAeuJ.m$LaTdnIBzxWb71oObNgFTx/

rito:$apr1$mFwqLnWl$DErf.PJTjijn3Xt8eJfDG/

 

vim /etc/httpd/conf/httpd.conf

#DocumentRoot "/var/www/html"

DocumentRoot "/var/www/taxing"

<Directory "/var/www/taxing">

        #require all granted

        AllowOverride All

        Authuserfile /etc/httpd/htpasswdfile#读取文件

        Authname "Please input username and password"#

        Authtype basic

        Require user timo

</Directory>

 

3.创建虚拟主机

vim /etc/http/conf/httpd.conf#删除之前的修改,恢复到修改之前

mkdir /var/www/virtual/news.timo.com/html -p

mkdir /var/www/virtual/music.timo.com/html -p

cd /etc/http/conf.d/

vim default.conf

<Virtualhost _dafault_:80>

        Documentroot /var/www/html

        Customlog "logs/default.log" combined

</Virtualhost>

<Directory "/var/www/html">

        Require all granted

</Directory>

vim news.conf

<Virtualhost *:80>

        Servername news.timo.com

        Documentroot /var/www/virtual/news.timo.com/html

        Customlog "logs/news.log" combined

</Virtualhost>

<Directory "/var/www/virtual/news.timo.com/html">

        Require all granted

</Directory>                        

cp news.conf music.conf

vim music.conf

<Virtualhost *:80>

        Servername music.timo.com

        Documentroot /var/www/virtual/music.timo.com/html

        Customlog "logs/music.log" combined

</Virtualhost>

<Directory "/var/www/virtual/music.timo.com/html">

        Require all granted

</Directory>

cd /var/www/virtual/news.timo.com/html

vim index.html

news.timo.com

cd/var/www/virtual/music.timo.com/html

vim index.html

music.timo.com

在使用浏览器主机上

vim /etc/hosts

172.25.254.124 www.timo.com timo.com music.timo.com news.timo.com

 

4.创建自己的https证书

yum install  mod_ssl -y

systemctl restart httpd.service

 

netstat -antlpe | grep 443

yum install crypto-utils.x86_64 -y

genkey www.timo.com

http2

http2

http2

http2

http2

http2

http2

http2

ls /etc/pki/tls/certs/

vim /etc/http/conf.d/ssl.conf

SSLCertificateFile /etc/pki/tls/certs/www.timo.com.crt

SSLCertificateKeyFile /etc/pki/tls/private/www.timo.com.key

在客户机:https://172.25.254.124

 

ctrl+alt+delete删除缓存


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI