{"id":514584,"date":"2025-12-11T05:44:18","date_gmt":"2025-12-11T05:44:18","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=514584"},"modified":"2025-12-11T12:03:38","modified_gmt":"2025-12-11T12:03:38","slug":"how-to-configure-varnish-on-magento-2-with-nginx","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/","title":{"rendered":"How to configure Varnish on Magento 2 with Nginx"},"content":{"rendered":"\n<p>This blog explains how to <strong>Configure Varnish on Magento 2<\/strong> with Nginx as an <a href=\"https:\/\/docs.nginx.com\/nginx\/admin-guide\/security-controls\/terminating-ssl-tcp\/\">SSL termination<\/a> layer.<br>The setup uses a clean separation between SSL handling, caching, and Magento execution.<\/p>\n\n\n\n<p>When you run a Magento 2 store with Varnish Cache for full-page caching, and serve via Nginx as your web server, you need to chain them appropriately. The typical architecture is:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">Client \u2192 (HTTP\/HTTPS) \u2192 Nginx (SSL termination or plain HTTP) \u2192 Varnish (port 80) \u2192 Nginx + PHP-FPM (backend, e.g. port 8080) \u2192 Magento 2<\/pre>\n\n\n\n<p>Below are the steps to set this up:<\/p>\n\n\n\n<h2 class=\"wp-block-heading index-title\"><strong>1. Install and start Varnish<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install Varnish on your server. e.g. on Ubuntu:<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\">sudo apt update\nsudo apt install varnish -y<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Enable and start the Varnish service:<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\">sudo systemctl enable varnish\nsudo systemctl start varnish<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Confirm installation, e.g.:<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\">varnishd -V<\/pre>\n\n\n\n<p>Once installed, Varnish is ready.<\/p>\n\n\n\n<h2 class=\"wp-block-heading index-title\"><strong><strong>2. Configure Nginx to work with Varnish + Magento<\/strong><\/strong><\/h2>\n\n\n\n<p>Since Varnish will listen on port <strong>80<\/strong> (handling public incoming HTTP), you must move Nginx to listen on a different port (e.g. 8080).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Nginx Configuration Strategy<\/strong><\/h3>\n\n\n\n<p>This setup uses two Nginx configuration files.<br>Each file handles a clearly defined responsibility.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why two configs work better<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Clean separation of concerns<\/li>\n\n\n\n<li>Safer backend isolation<\/li>\n\n\n\n<li>Easier troubleshooting<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Frontend Nginx Configuration (SSL Termination)<\/strong><\/h3>\n\n\n\n<p>The <code>magento_site.conf<\/code> file manages public traffic. It terminates SSL and forwards all requests to Varnish. It also protects Magento from direct access. Only Varnish receives proxied traffic.<\/p>\n\n\n\n<p><strong><em>\/etc\/nginx\/conf.d\/magento_site.conf<\/em><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\"># HTTP to HTTPS redirect\nserver {\n    listen 8090;\n    server_name mywebiste.webkul.in;\n    return 301 https:\/\/$host:8443$request_uri;\n}\n\n# Main HTTPS server block\nserver {\n    listen 8443 ssl; http2 on; # Listen on port 443 with SSL and HTTP\/2\n    server_name mywebiste.webkul.in; # Replace with your domain name\n\n    # SSL certificate paths\n    ssl_certificate \/etc\/letsencrypt\/live\/webkul.in\/fullchain.pem;\n    ssl_certificate_key \/etc\/letsencrypt\/live\/webkul.in\/privkey.pem;\n\n    # Recommended SSL settings (adjust as needed)\n    ssl_protocols TLSv1.2 TLSv1.3;\n    ssl_ciphers &#039;TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256&#039;;\n    ssl_prefer_server_ciphers on;\n    ssl_session_cache shared:SSL:10m;\n    ssl_session_timeout 1h;\n    #ssl_stapling off;\n    ssl_stapling_verify on;\n    add_header Strict-Transport-Security &quot;max-age=63072000; includeSubDomains; preload&quot; always;\n    add_header X-Frame-Options &quot;SAMEORIGIN&quot;;\n    add_header X-Content-Type-Options &quot;nosniff&quot;;\n\n\n    # &gt;&gt;&gt; Add these lines here to fix the 502 Bad Gateway error: &lt;&lt;&lt;\n    proxy_buffer_size 128k;\n    proxy_buffers 4 256k;\n    proxy_busy_buffers_size 256k;\n    proxy_max_temp_file_size 0;\n\n      # This single location block handles everything and sends it to Varnish:\n    location \/ {\n        # Pass ALL requests to Varnish (listening on port 80)\n        proxy_pass http:\/\/127.0.0.1:80; \n        \n        # Pass necessary headers so Varnish\/Magento know about the original HTTPS request\n        proxy_set_header Host $http_host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto https; # Indicates the original protocol was HTTPS\n        proxy_set_header X-Forwarded-Port 8443;\n    }\n    \n    # Security headers\n    add_header X-Frame-Options &quot;SAMEORIGIN&quot;;\n    add_header X-Content-Type-Options &quot;nosniff&quot;;\n    add_header X-XSS-Protection &quot;1; mode=block&quot;;\n    add_header X-PHP-FPM &quot;Handled by FastCGI&quot;;\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Backend Nginx Configuration (Magento Internal Server)<\/strong><\/h3>\n\n\n\n<p>The <code>magento_backend.conf<\/code> file serves Magento internally and only varnish can access this server. It keeps the PHP-FPM isolated.<\/p>\n\n\n\n<p><strong><em>\/etc\/nginx\/conf.d\/magento_backend.conf<\/em><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">upstream fastcgi_backend {\n    server unix:\/run\/php\/php8.3-fpm.sock;\n}\n\nserver {\n    listen 8080; # INTERNAL PORT: Only listens for requests from Varnish\/localhost\n    server_name mywebiste.webkul.in;\n\n    # Set Magento&#039;s root directory for includes\n    set $MAGE_ROOT \/home\/users\/webkul.user\/www\/html\/nginx-magento;\n\n    # Include Magento&#039;s default Nginx configuration file\n    include \/home\/users\/webkul.user\/www\/html\/nginx-magento\/nginx.conf.sample;\n\n    location ~ \\.php$ {\n        include fastcgi_params;\n        fastcgi_pass unix:\/run\/php\/php8.3-fpm.sock;\n        fastcgi_index index.php;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        \n        # !! IMPORTANT FOR VARNISH SETUP !! \n        # Tell Magento the original request was secure, even though Varnish sends it over HTTP\n        fastcgi_param HTTPS on; \n        fastcgi_read_timeout 300;\n        fastcgi_connect_timeout 300;\n        fastcgi_send_timeout 300;\n    }\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading index-title\"><strong><strong><strong>3. Configure Varnish to forward to Nginx backend<\/strong><\/strong><\/strong><\/h2>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Now point Varnish\u2019s backend to Nginx (on port 8080):<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1. Export the default VCL for Magento 2 from the Magento Admin:<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In Admin, go to <strong>Stores \u2192 Configuration \u2192 Advanced \u2192 System \u2192 Full Page Cache<\/strong>.<\/li>\n\n\n\n<li>Set <em>Caching Application<\/em> to <strong>Varnish Cache<\/strong>.<\/li>\n\n\n\n<li>Expand <em>Varnish Configuration<\/em>, set backend host (commonly <code>127.0.0.1<\/code>) and backend port (e.g. <code>8080<\/code>).<\/li>\n\n\n\n<li>Click <strong>Export VCL<\/strong> (choose version matching your Varnish) \u2014 Magento will download a file (e.g. <code>varnish.vcl<\/code>).<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">2. Place that <code>.vcl<\/code> in Varnish config directory:<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\">sudo cp \/path\/to\/downloaded\/varnish.vcl \/etc\/varnish\/default.vcl<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. In <code>default.vcl<\/code>, ensure the backend block points to Nginx backend:<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\">backend default {\n    .host = &quot;127.0.0.1&quot;;\n    .port = &quot;8080&quot;;\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">4. Update the Varnish VCL for GraphQL Caching:<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Modify <code>sub vcl_recv<\/code> Block<\/h6>\n\n\n\n<pre class=\"EnlighterJSRAW\"># Enable caching for public GraphQL GET requests\nif (req.method == &quot;GET&quot; &amp;&amp; req.url ~ &quot;^\/graphql&quot;) {\n    unset req.http.Cookie;\n}<\/pre>\n\n\n\n<p>This ensures GraphQL <strong>GET requests<\/strong> are cacheable by <strong>removing cookies<\/strong>:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Comment Out the Default Magento Bypass Logic<\/h6>\n\n\n\n<pre class=\"EnlighterJSRAW\"># Disabled to allow GraphQL caching for public requests\n# if (req.url ~ &quot;\/graphql&quot; &amp;&amp; !req.http.X-Magento-Cache-Id &amp;&amp; req.http.Authorization ~ &quot;^Bearer&quot;) {\n#     return (pass);\n# }<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5. Restart Varnish After Changes:<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\">sudo systemctl restart varnish<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">6. Restart Nginx After All the Changes:<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\">sudo systemctl restart nginx<\/pre>\n\n\n\n<h2 class=\"wp-block-heading index-title\"><strong><strong><strong>4. Conclusion<\/strong><\/strong><\/strong><\/h2>\n\n\n\n<p>This guide demonstrated how to <strong>Configure Varnish in Magento 2<\/strong> using Nginx as SSL termination.<br>The setup follows a clean and secure production architecture.<\/p>\n\n\n\n<p>Nginx handles HTTPS efficiently. Varnish delivers fast cached responses. Magento remains isolated and stable under load. This configuration aligns with enterprise Magento best practices.<\/p>\n\n\n\n<p>Looking to improve your store\u2019s speed and overall performance? Check out our <a href=\"https:\/\/webkul.com\/magento-speed-optimization-services\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 Speed &amp; Optimization services<\/a>.<\/p>\n\n\n\n<p>For expert guidance or custom feature development, you may <strong><a href=\"https:\/\/webkul.com\/hire-magento-developers\/\" target=\"_blank\" rel=\"noreferrer noopener\">hire our Magento 2 developers<\/a><\/strong> to support your project.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog explains how to Configure Varnish on Magento 2 with Nginx as an SSL termination layer.The setup uses a clean separation between SSL handling, caching, and Magento execution. When you run a Magento 2 store with Varnish Cache for full-page caching, and serve via Nginx as your web server, you need to chain them <a href=\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":448,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121],"tags":[14267,383,2460,2247,6977],"class_list":["post-514584","post","type-post","status-publish","format-standard","hentry","category-magento-2","tag-full-page-caching","tag-graph-api","tag-magento-2","tag-nginx","tag-varnish"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to configure Varnish on Magento 2 with Nginx - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Learn how to configure Varnish Cache with Magento 2 using Nginx as SSL-termination. A step-by-step guide covering Nginx &amp; Varnish setup.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to configure Varnish on Magento 2 with Nginx - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Learn how to configure Varnish Cache with Magento 2 using Nginx as SSL-termination. A step-by-step guide covering Nginx &amp; Varnish setup.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-11T05:44:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-11T12:03:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ishtiyaque Ahmad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ishtiyaque Ahmad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\"},\"author\":{\"name\":\"Ishtiyaque Ahmad\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/87870dc3a96bd31e595f7f52a88039ed\"},\"headline\":\"How to configure Varnish on Magento 2 with Nginx\",\"datePublished\":\"2025-12-11T05:44:18+00:00\",\"dateModified\":\"2025-12-11T12:03:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\"},\"wordCount\":435,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"keywords\":[\"Full Page Caching\",\"graph api\",\"Magento 2\",\"nginx\",\"varnish\"],\"articleSection\":[\"Magento 2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\",\"name\":\"How to configure Varnish on Magento 2 with Nginx - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2025-12-11T05:44:18+00:00\",\"dateModified\":\"2025-12-11T12:03:38+00:00\",\"description\":\"Learn how to configure Varnish Cache with Magento 2 using Nginx as SSL-termination. A step-by-step guide covering Nginx & Varnish setup.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to configure Varnish on Magento 2 with Nginx\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/87870dc3a96bd31e595f7f52a88039ed\",\"name\":\"Ishtiyaque Ahmad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c3a094b2512bcdac14021c72f014bee8e6781d99ac6028e78098a07e7aec32b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c3a094b2512bcdac14021c72f014bee8e6781d99ac6028e78098a07e7aec32b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ishtiyaque Ahmad\"},\"description\":\"Ishtiyaque Ahmad, a Magento Certified Developer, is an expert in Magento 2 development and eCommerce platforms.&nbsp;Expertise in crafting custom solutions, optimizing workflows, and integrating seamless eCommerce features drives business growth and operational efficiency.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/ishtiyaque-ahmad755\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to configure Varnish on Magento 2 with Nginx - Webkul Blog","description":"Learn how to configure Varnish Cache with Magento 2 using Nginx as SSL-termination. A step-by-step guide covering Nginx & Varnish setup.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/","og_locale":"en_US","og_type":"article","og_title":"How to configure Varnish on Magento 2 with Nginx - Webkul Blog","og_description":"Learn how to configure Varnish Cache with Magento 2 using Nginx as SSL-termination. A step-by-step guide covering Nginx & Varnish setup.","og_url":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2025-12-11T05:44:18+00:00","article_modified_time":"2025-12-11T12:03:38+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Ishtiyaque Ahmad","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ishtiyaque Ahmad","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/"},"author":{"name":"Ishtiyaque Ahmad","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/87870dc3a96bd31e595f7f52a88039ed"},"headline":"How to configure Varnish on Magento 2 with Nginx","datePublished":"2025-12-11T05:44:18+00:00","dateModified":"2025-12-11T12:03:38+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/"},"wordCount":435,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"keywords":["Full Page Caching","graph api","Magento 2","nginx","varnish"],"articleSection":["Magento 2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/","url":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/","name":"How to configure Varnish on Magento 2 with Nginx - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2025-12-11T05:44:18+00:00","dateModified":"2025-12-11T12:03:38+00:00","description":"Learn how to configure Varnish Cache with Magento 2 using Nginx as SSL-termination. A step-by-step guide covering Nginx & Varnish setup.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-configure-varnish-on-magento-2-with-nginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to configure Varnish on Magento 2 with Nginx"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/87870dc3a96bd31e595f7f52a88039ed","name":"Ishtiyaque Ahmad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c3a094b2512bcdac14021c72f014bee8e6781d99ac6028e78098a07e7aec32b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c3a094b2512bcdac14021c72f014bee8e6781d99ac6028e78098a07e7aec32b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ishtiyaque Ahmad"},"description":"Ishtiyaque Ahmad, a Magento Certified Developer, is an expert in Magento 2 development and eCommerce platforms.&nbsp;Expertise in crafting custom solutions, optimizing workflows, and integrating seamless eCommerce features drives business growth and operational efficiency.","url":"https:\/\/webkul.com\/blog\/author\/ishtiyaque-ahmad755\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/514584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/448"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=514584"}],"version-history":[{"count":26,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/514584\/revisions"}],"predecessor-version":[{"id":516392,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/514584\/revisions\/516392"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=514584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=514584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=514584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}