「德州网站优化」Apache和Nginx禁止通过IP访问网站防止恶意解析

「德州网站优化」
Apache http禁止通过IP直接访问网站安全配置方法
#NameVirtualHost xx.xxx.xxx.xx
<VirtualHost *:80>
ServerName xx.xxx.xxx.xx
ServerAlias xx.xxx.xxx.xx
<Location />
Order Allow,Deny
Deny from all
</Location>
</VirtualHost>
Apache https禁止通过IP直接访问网站安全配置方法
#NameVirtualHost xx.xxx.xxx.xx
<VirtualHost *:443>
ServerName xx.xxx.xxx.xx
ServerAlias xx.xxx.xxx.xx
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
SSLHonorCipherOrder on
SSLCertificateFile /etc/letsencrypt/live/360gzseo.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/360gzseo.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/360gzseo.com/fullchain.pem
#上面两条SSL证书的路径要换成你自己的路径,把360gzseo.com修改成你的网站存放的文件夹
<Location />
Order Allow,Deny
Deny from all
</Location>
</VirtualHost>
Nginx http禁止通过IP直接访问网站安全配置方法
server
    {
        listen 80 default;
        return 403;
    }
Nginx http和https禁止通过IP直接访问网站安全配置方法
server
{
listen 80 default;
listen 443 default_server;
server_name _;
return 403;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /etc/letsencrypt/live/360gzseo.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/360gzseo.com/privkey.pem;
#上面两条SSL证书的路径要换成你自己的路径,把360gzseo.com修改成你的网站存放的文件夹
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM- 
SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-END
}

配置时以防出错,请提前做好备份。

「德州网站优化」
上一篇:「seo优化软件」WordPress实现留言、注册、修改密码时SMTP邮件发送通知功能
下一篇:「优化网站排名」SEM是什么

欢迎扫描关注我们的微信公众平台!

欢迎扫描关注我们的微信公众平台!

.ewkf-box{position:fixed;right:10px;top:200px;} .ewkf-box .im-box{display:block;} .ewkf-box .open-im{display:none;float:right;}