Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following nginx location blocks:

location /publish/ {
  deny all;

location ~\.php {
  try_files $uri =404;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  fastcgi_intercept_errors on;
  include /etc/nginx/fastcgi_params;

The problem is that the location block /publish/ does not seem to be executing. I can call the php script from any host.

Ideas? Thanks much.

share|improve this question

Use the = location prefix to determine exact match. As it is written in nginx documentation: "If an exact match is found, the search terminates."

So, your location should look like:

location = /publish/ {
  deny all;              # Gives 403


location = /publish/ {
  internal;              # Gives 404
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.