Symfony2的Nginx配置

来源:互联网 发布:sql删除前10条记录 编辑:程序博客网 时间:2024/05/24 03:34

经验证可用的Nginx.conf配置:

    server {        server_name  192.168.1.3;#        root         /usr/share/nginx/html;        root ~/sym2/test/web;        location / {                try_files $uri /app.php$is_args$args;        }        # Forward PHP request to FastCGI, using PHP-fpm        location ~ ^/(app_dev|config)\.php(/|$) {                fastcgi_pass   127.0.0.1:9000;                fastcgi_split_path_info ^(.+\.php)(/.*)$;                include fastcgi_params;                fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;                fastcgi_param DOCUMENT_ROOT $realpath_root;        }        # return 404 for all other php files not matching the front controller        # this prevents access to other php files you don't want to be accessible.        location ~ \.php$ {                return 404;        }    }