Skip to content

Nginx Includes

Custom directives are easy to add and hard to master.  Common examples used by our customers are listed below.

WordPress

Add this to get WordPress working in a subdirectory of your web-root, substitute the blog path for your particular sub-directory.

location /blog/ {
index index.php index.html index.htm;
try_files $uri $uri/ /blog/index.php?$args ;
location ~* \.php$ { try_files /dummy @proxy; }
}

location /blog/wp-admin/ {
index index.php index.html index.htm;
try_files /blog/wp-admin/$uri /blog/wp-admin/$uri/ /blog/wp-admin/index.php?$args ;
location ~* \.php$ { try_files /dummy @proxy; }
}

Custom PHP Scripts

The default Stratus Nginx template does not allow PHP execution in directories not required by Magento.  A special Nginx location is required if you have custom scripts or other PHP based code you need to run

location ~* my_custom_scripts/ {
try_files $uri $uri/ /index.php?$args;
location ~* \.php$ { try_files /dummy @proxy; }
}

Change my_custom_scripts in the example above to match your requirements.