为什么我的nginx配置不起作用?

时间:2018-02-09 03:13:13

标签: nginx phalcon

我正在尝试设置nginx以开始使用phalcon,这是配置:

server {
    listen      80;
    server_name localhost.dev;
    set $root_path '/usr/share/nginx/html/phalcon/public';
    root        $root_path;
    index       index.php index.html index.htm;
    charset     utf-8;
    rewrite_log on;

    location / {
        try_files $uri $uri/ /index.php?_url=$uri&$args;
    }

    location ~ \.php$ {
        try_files     $uri =404;

        fastcgi_pass   unix:/var/run/php/php5.6-fpm.sock;
        fastcgi_index /index.php;

        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/public;
    }

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

我尝试了所有可能但仍然无法让它发挥作用。 有线索吗?

1 个答案:

答案 0 :(得分:0)

看这里

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