---
title: "Wordpress Nginx Config"
canonical: "https://techwiki.co.uk/linux/wordpress-nginx-config"
author: "Adam Birds"
article_type: "documentation"
published: "2026-08-10T23:29:58.499Z"
updated: "2026-08-10T23:29:58.499Z"
categories: ["Cms","Linux","Web Servers"]
tags: []
---**Here is the Nginx Config for a Public Wordpress with a locked down Admin section:**

```

upstream examplecombackend {
server unix:/var/run/php-fcgi-examplecom.sock;
}

server {
listen 80;
server_name example.com;
root /var/www/vhosts/example.com/htdocs;
index index.php;

access_log /var/www/vhosts/example.com/access.log;
error_log /var/www/vhosts/example.com/error.log warn;

location / {
try_files $uri $uri/ @handler;
index index.php index.html;
}

#       location /app/                  { deny all; }
#       location /includes/             { deny all; }
#       location /lib/                  { deny all; }
#       location /media/downloadable/   { deny all; }
#       location /pkginfo/              { deny all; }
#       location /report/config.xml/    { deny all; }
#       location /images/               { deny all; }
#       location /var/                  { deny all; }
1.
#       location /download/             { allow 1.1.1.1; deny all; }

location /. {
return 404;
}

location @handler {
rewrite ^/(.*)$ /index.php;
}

#        location ~ \.zip$ {
#                allow 1.1.1.1;
#                deny all;
#        }

location ~ ^/wp-(admin|login).php {
location ~ \.php$ {
fastcgi_intercept_errors on;
fastcgi_pass examplecombackend;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include        fastcgi_params;
}
}
location ~ \.php$ {
fastcgi_intercept_errors on;
fastcgi_pass examplecombackend;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include        fastcgi_params;
}

#        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
#                expires max;
#                log_not_found off;
#        }

}

```
