• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / nginx server tutorials (installation, configuration, performance tuning, security) / Top 10 tips to improve nginx server security

Top 10 tips to improve nginx server security

 

inorder to implement security rules, first we know the types attacks & vulnerabilities of server, or linux kernel.

most common attacks are

#1 brute force attacks ddos (to take down the server)

#2 SQL injection (to gain access to database to steal valuable info like customer credit card details)

#3XSS cross site injection

sending post requests from their severs, to our database.

#4 application level vulnerabilities, kernel level etc.

 

 

 

Table of Contents

Toggle
  • rate limiting
  • disable unwanted modules /install with required modules
  • Disable nginx server_tokens
    • avoid large buffer size
    • disable unwanted methods
  • install mod security or other waf solutions
  • Monitor nginx with status module /New relic / datadog
  • #add security headers
    • Strict-Transport-Security only https
    • CSP and X-XSS-Protection headers
    • Confogure latest ssl vesions & ciphersuites
    • update nginx upto date

rate limiting

we can configure it in nginx.conf
blocking certain ip address , once it reaches the maximum request per second.
this way we can avoid brute force attacks

disable unwanted modules /install with required modules

so we limit operation
less exposure
# ./configure –without-http_autoindex_module
# make
# make install

Disable nginx server_tokens

server_tokens off
in nginx.conf

avoid large buffer size

large_client_header_buffers
client_max_body_size
client_header_buffer_size
client_body_buffer_size

disable unwanted methods

location /
{limit_except GET HEAD POST { deny all; }}
unwanted methods like delete trace blocks by nginx.

install mod security or other waf solutions

setup critical access loge for convienent
error_log logs/error.log crit;

Monitor nginx with status module /New relic / datadog

nginx statut module free but you need recompile the nginx.
or follow the approache how to use nginx dynamic modules
New relic & data dog server & application monitoring services at entrepreneur level.
also try netdata.
my recommendation is newrelic, you can also track on android app.

#add security headers

disable iframes on other websites
add_header X-Frame-Options “SAMEORIGIN”;

Strict-Transport-Security only https

add_header Strict-Transport-Security “max-age=31536000; includeSubdomains; preload”;

CSP and X-XSS-Protection headers

CSP
content security policy, xss crosite scripting attacks,
you must understand the policies must before yding this.
add_header Content-Security-Policy “default-src ‘self’ http: https: data: blob: ‘unsafe-inline'” always;
Xss
getting data from your server database by post requests .
add_header X-XSS-Protection “1; mode=block”;

Confogure latest ssl vesions & ciphersuites

ssl 3 or tls 1 version old its easy to hckable.
tsl 1.2 also some vulnarebilies
tls 1.3 new but almost all browser supports now as on 2020
ssl_protocols TLSv1.2 TLSv1.3
ciphersuites Based on server not from user
ssl_prefer_server_ciphers on;

update nginx upto date

to know what’s they fixed, added new features.
always do
apt-update
upgrable command
thrn check details on their website nginx.org
to check nginx security
Install gixy
pip install gixy
&run
gixy
it checks
/etc/nginx/nginx.conf
iptables /ufw /firewall d also helps to strengthen the security.
https://github.com/yandex/gixy
https://www.digitalocean.com/community/tools/nginx?domains.1.server.domain=example2.com

Primary Sidebar

nginx server tutorials (installation, configuration, performance tuning, security)

  • Letsencrypt SSL Installation on apache/Nginx ubuntu / debian wordpress
  • fix error 520 522 524 on cloudflare wordpress godaddy nginx etc
  • nginx fastcgi cache wordpress how to configure
  • install LEMP Stack on 22.04 LTS Nginx MySQL PHP fpm #wordpress #digital ocean
  • Apache vs nginx (connection handling, modules, memory usage)
  • Pagespeed module install, configure, monitor, errors ft nginx &apache
  • nginx errors (504,502, 413, unable to start, syntax errors)
  • nginx conf explained best config file performance tuning tips nginx.conf location errors tutorial
  • use nginx as reverse proxy and load balancer for apache wordpress
  • nginx rewrite rules with examples 301 redirection
  • nginx modules list (enable, disable, upgrade, install dynamic module)
  • php fpm pool manager configuration settings based on server spike high cpu wordpress
  • php fpm restart nginx ubuntu enable status page, monitor etc
  • what is TTFB & how to Reduce it (server response time) Google pagespeed
  • letsencrypt install configure on ubuntu / debian nginx
  • Top 10 tips to improve nginx server security
  • nginx performance tuning connections, buffers file descriptors
  • enable brotli compression nginx brotli vs gzip
  • nginx installation on ubuntu 20.04 LTS
  • monitor nginx request with nginx status amplify datadog new relic
  • SSL faster reduce TLS hand shake improve https performance
  • nginx rate limiting explained by location time specific url
  • datadog nginx integration installation process
  • newrelic nginx integration process and errors fix and metrics
  • php fpm seems busy fixed warning and max children reached to handle max connections / requests
  • Php fpm configuration for 1000 concurrent connections server busy max children reached
  • php fpm ondemand vs dynamic vs Static (the dynamic pool problem)
  • nginx upstream response is buffered to a temporary file
  • php fpm install ubuntu 20.04 nginx
  • install phpmyadmin ubuntu nginx 22.04
  • upgrade php fpm ubuntu nginx 7.4 to 8.2
  • nginx add last modified header (remove, php wordpress)
  • php fpm dynamic pool manager settings
  • nginx fastcgi cache purge
  • nginx open file limit connections ulimits sysctl
  • php fpm high cpu usage WordPress 4 solutions nay work for you
  • nginx buffer size for wordpress
  • Cloudflare error code 524 nginx a timeout error occured
  • server configuration for 1000 concurrent users

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy