Arama Yap Mesaj Gönder
Biz Sizi Arayalım
+90
X
X
X
X

Knowledge Base

Homepage Knowledge Base General Plesk Nginx Optimization: Boost Spe...

Bize Ulaşın

Konum Halkalı merkez mahallesi fatih cd ozgur apt no 46 , Küçükçekmece , İstanbul , 34303 , TR

Plesk Nginx Optimization: Boost Speed and Security

Plesk Panel is a widely used, user-friendly control panel for web hosting management. Plesk, which works integrated with Apache, uses Nginx as a reverse proxy by default. However, the full potential performance gains cannot be realized if proper optimization is not done. This article explains step by step how to optimize Nginx configuration on Plesk Panel, static content caching, gzip compression, cache management, and security settings.


1. The Role of Nginx on Plesk
In Plesk, Nginx runs in front of Apache by default and handles incoming HTTP requests. It provides significant performance advantages in serving static content (CSS, JS, images).

Advantages:

  • Lower memory usage

  • High speed for static files

  • Advanced cache support


2. Checking and Activating Nginx Status in Plesk
Plesk Panel >> Tools & Settings >> Apache Web Server & nginx Settings

  • The "Place nginx in front of Apache" box should be checked

  • The "Use nginx to serve static files" option should be active

Check with SSH:

systemctl status nginx

If not active:

systemctl start nginx
systemctl enable nginx

3. Enabling GZIP Compression
GZIP compression increases page loading speed by reducing file sizes.

Add the following lines to the nginx configuration via SSH (usually /etc/nginx/conf.d/gzip.conf or /etc/nginx/conf.d/custom.conf):

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

Restart Nginx:

systemctl restart nginx

4. Cache Configuration
You can reduce server load by enabling Nginx cache settings for static content.

Create a new file named /etc/nginx/conf.d/static_cache.conf via SSH:

location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
    expires 30d;
    add_header Pragma public;
    add_header Cache-Control "public";
}

For more advanced caching, the proxy_cache system can also be configured:

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=60m use_temp_path=off;

server {
    location / {
        proxy_cache STATIC;
        proxy_pass http://backend;
        add_header X-Cache-Status $upstream_cache_status;
    }
}

5. SSL and HTTP/2 Optimization
HTTP/2 support provides much faster loading in modern browsers.

Plesk >> Tools & Settings >> Apache & nginx Settings

  • Check the "Enable HTTP/2" box (SSL must be active)

Additionally, check the following lines in the ssl.conf file:

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

6. Security Settings and Attack Prevention

  • Rate limit implementation with Nginx:

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

location / {
    limit_req zone=one burst=5;
}
  • Bad bot blocking:

if ($http_user_agent ~* (badbot1|badbot2|crawler)) {
    return 403;
}

7. Nginx Errors and Log Analysis
Review log files for errors:

tail -f /var/log/nginx/error.log

For performance monitoring:

tail -f /var/log/nginx/access.log

8. Performance Monitoring and Log Maintenance

  • Follow updates via Plesk Panel for Nginx module updates

  • Check for configuration errors with the nginx -t command

  • Restart the service after changes with systemctl restart nginx


Conclusion
Nginx optimization on Plesk Panel increases the loading speed of websites, uses server resources efficiently, and improves the user experience. The steps described above provide both speed increases in static content and increase the security of the server.

For more performance and security optimization, you can check our Server Setup and Optimization Services page.

 

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(7527 times viewed / 280 people found it helpful)

Call now to get more detailed information about our products and services.

Top