1、lnmp安全加固总结
lnmp安装我就不演示了,这个很简单,网上也有很多教程,装完后我们可以优化一下lnmp架构
1.1 浏览器访问暴露的信息,nginx,php版本信息隐藏
打开浏览器按F12,点击网络,找到一个请求,可以看到下面图片信息

修改nginx可以隐藏版本信息
[root@centos-7 ~]#cat /apps/nginx/conf.d/php.conf
server {
listen 80;
server_name ;
server_tokens off;
location / {
root /data/nginx/wordpress;
index index.php index.html;
}
location ~ \.php$ {
root /data/nginx/wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}
location ~ ^/(ping|pm_status)$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
}
}
[root@centos-7 ~]#/apps/nginx/sbin/nginx -t
[root@centos-7 ~]#/apps/nginx/sbin/nginx -s reload

1.2 配置 php 开启 opcache 加速
[root@centos-7 ~]#vim /etc/php.ini
[opcache]
; Determines if Zend OPCache is enabled
zend_extension=
opcache.enable=1
[root@centos-7 ~]#systemctl restart php-fpm

















