Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

vhost:

server {
        listen *:8080;

        location / {
                root   /var/www/default/pub;
                index index.php;

                # if file exists return it right away
                if (-f $request_filename) {
                        break;
                }

                if (!-e $request_filename) {
                        rewrite ^(.+)$ /index.php$1 last;
                        break;
                }

        }
        # serve static files directly
         location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
         access_log off;
         expires max;
  }

  location ~* \.php$ {
    # By all means use a different server for the fcgi processes if you need to
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_script_name;
    include /usr/local/nginx/conf/fastcgi_params;
  }

  location ~ /\.ht {
    deny  all;
  }
}

http://192.168.135.128/index.php loads just fine...

http://192.168.135.128/public_/html/index.php downloads...

share|improve this question
    
You listen on 8080 so neither of those URLs ever touch Nginx. Also when you do starting using Nginx PHP won't work at all due to some basic mistake. I highly suggest you read my primer to get an understanding of the Nginx configuration file: blog.martinfjordvald.com/2010/07/nginx-primer –  Martin Fjordvald Feb 6 '11 at 7:43
    
i have varnish in front of nginx doing caching and it runs on port 80 –  Sam Williams Feb 6 '11 at 17:58
add comment

1 Answer

Your vhost work well(but port 8080):

# curl localhost:8080/public_/html/index.php
123

/var/www/default/pub/public_/html/index.php:

<?php
echo "123";
?>
share|improve this answer
add comment

Your Answer

 
discard

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.