Nginx运行php的配置

来源:互联网 发布:钣金外壳 软件 编辑:程序博客网 时间:2024/05/20 04:15
server {
        listen 8001;
        server_name localhost;
        
        set $root_path /Users/pasenger/Code/github/php/phalcon/tutorial/public; 
        root $root_path;

        #access_log /var/log/nginx/$host-access.log; error_log /var/log/nginx/$host-error.log error;
        
        index index.php;

        try_files $uri $uri/ @rewrite;
        location @rewrite {
            rewrite ^/(.*)$ /index.php?_url=/$1;
        }

        location ~ \.php {
            # try_files    $uri =404;
            fastcgi_index /index.php; 
            fastcgi_pass 127.0.0.1:9000;
            include fastcgi_params;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

        location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { 
            root $root_path;
        }

        location ~ /\.ht { 
            deny all;
        }
    }
0 0
原创粉丝点击