Magento WordPress Integration NginxWordPress Integration

« Back to Magento WordPress Integration

Magento 2 now supports Nginx and includes a usable Nginx config file with the default installation called nginx.conf.sample. It is possible to include this file directly into your main Nginx conf file to get Magento working.

The nginx.conf.sample file doesn't cover WordPress but it is easy to get WordPress up and running on Nginx.

The below code extract should go inside your main server block but after you have included nginx.conf.sample. It assumes that you have installed WordPress in either pub/wp or /wp.

location /wp/ {
  index index.html index.php;
  try_files $uri $uri/ /wp/index.php?q=$uri&args;

  location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  /wp/index.php;
    include        fastcgi.conf;
  }
}