Symfony Ngnix-使app.php可执行

Symfony Ngnix-使app.php可执行,symfony,Symfony,我希望app.php是可执行的,就像index.php一样。我如何设置这个 它是为symfony设计的,因为symfony没有index.php。它已经是可执行的了!我认为您的意思是让apache查找app.php而不是index.php,为此,您应该配置.htaccess文件并添加如下内容: DirectoryIndex app.php 带有php5 fpm的本地虚拟主机示例 server { listen 80; server_name your.site.lan;

我希望app.php是可执行的,就像index.php一样。我如何设置这个


它是为symfony设计的,因为symfony没有index.php。

它已经是可执行的了!我认为您的意思是让apache查找app.php而不是index.php,为此,您应该配置.htaccess文件并添加如下内容:

DirectoryIndex app.php

带有php5 fpm的本地虚拟主机示例

server {
    listen 80;

    server_name your.site.lan;

    root /var/www/your.site.lan/web;

    error_log /var/log/nginx/site.error.log;
    access_log /var/log/nginx/site.access.log;

    # strip app.php/ prefix if it is present
    rewrite ^/app\.php/?(.*)$ /$1 permanent;

    location / {
        index app.php;
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /app.php/$1 last;
    }

    # pass the PHP scripts to FastCGI server from upstream phpfcgi
    location ~ ^/(app|app_dev|index|app_test|config|info|apc)\.php(/|$) {
        fastcgi_pass phpfcgi;
        fastcgi_read_timeout 600;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param  HTTPS off;
    }
}
其中,phpfcgi是在http部分的nginx.conf上配置的别名

upstream phpfcgi {
        server unix:/var/run/php5-fpm.sock;
}