My PHP, Server, DataBase and Security Configurations

My Php, Server, Database And Security Configurations
Last Updated on

This is some of my website configurations, in case you are wondering and it’s good for me to refer back in future too.

php.ini settings

display_errors = Off
max_execution_time = 600
max_input_time = 400
max_input_vars = 10000
memory_limit = 8000M
post_max_size = 250M
session.gc_maxlifetime = 1440
upload_max_filesize = 250M
zlib.output_compression = On
expose_php = off
max_connections = 1000
max_user_connections = 1000
wait_timeout = 360
max_allowed_packet = 2048M
expose_php = off
zend_extension = opcache.so
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 1024
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 100000
opcache.max_wasted_percentage = 15
opcache.validate_timestamps = 1
opcache.revalidate_freq = 60
opcache.fast_shutdown = 1
opcache.force_restart_timeout = 300

.htaccess Security Headers

<IfModule mod_headers.c>
    Header set Expect-CT "max-age=7776000, enforce"
    Header always set Feature-Policy "accelerometer 'none'; ambient-light-sensor 'none'; encrypted-media 'none'; geolocation 'none'; midi 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; fullscreen 'none'; picture-in-picture *; autoplay 'none'; payment 'none';  sync-xhr * https://jorcus.com"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header unset X-Powered-By
    ServerSignature Off
</IfModule>

DataBase Optimization

DataBase optimization is very specific on the server environment setup. I can’t provide a recommendation for that, but I can share my MySQL/MariaDB database configuration on my website.

show variables like "max_connections";
set global max_connections := 1500;
show variables like 'query_cache_{"mode":"php","mime":"text/x-php","theme":"3024-night","lineNumbers":true,"styleActiveLine":false,"lineWrapping":false,"readOnly":true}et global query_cache_type = 1
set global query_cache_limit = 50000000
set global query_cache_min_res_unit = 2000
set global query_cache_size = 300000000