Products
96SEO 2025-07-28 08:13 6
在当今的网络周围中,网站的平安性是至关关键的。对于运行在CentOS操作系统上的PHP网站正确的配置和睦安的实践对于护着网站免受打至关关键。
sudo yum update
sudo yum install firewalld
sudo systemctl start firewalld
sudo systemctl enable firewalld
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
chattr +i
命令别让文件被更改。disable_functions = passthru,exec,system,shell_exec,popen,pcntl_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,phpinfo
display_errors = Off
log_errors = On
error_log = /var/log/php_
open_basedir = /var/www/html:/tmp
register_globals = Off
sudo yum install php-mcrypt php-gd php-mbstring php-bcmath
sudo yum install mod_ssl
sudo systemctl restart httpd
user = apache
group = apache
listen = /var/run/php-fpm.sock
listen.owner = apache
listen.group = apache
umask = 0007
pid = /var/run/php-fpm.pid
error_log = /var/log/php-fpm.log
log_level = warning
sudo systemctl restart php-fpm
sudo yum install mod_security
sudo systemctl enable mod_security
sudo systemctl start mod_security
sudo yum update php*
通过上述措施,能显著搞优良CentOS系统上PHP应用的平安性。想起来定期检查和更新鲜平安设置,以应对新鲜出现的平安吓唬。
Demand feedback