dopa53272 2016-03-29 14:17
浏览 75

Nginx为symfony3配置

I have some troubles with nginx. I created new project on Symfony3. Config.php says, that everything is good. dev_app.php - too. But when I try to open site without any other route, like sitename.com nginx returns 403 error. When I try to start symfnoy server (bin/console server:start) It's forbidden too. sitename.com:8000 returns me fail to opening this page.

site-available config is

upstream phpfcgi {
    server 127.0.0.1:8000;
}

server {
    listen 80;

    server_name localhost;
    root /home/staging/www/web;

    error_log /home/staging/logs/staging.error.log;
    access_log /home/staging/logs/staging.access.log;

    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|config)\.php(/|$) {
        fastcgi_pass phpfcgi;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param  HTTPS off;
    }
}

I added new entity with crud, but any actions doesn't work. I will be glad for any help. Thanks

  • 写回答

1条回答 默认 最新

  • douhui9380 2016-03-30 19:27
    关注

    Try to add

    rewrite ^/app\.php/?(.*)$ /$1 permanent;
    

    in the server section before any location sections (after the root /home/staging/www/web; line, for example).

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败