2

我在 nginx 中使用 Procfile 进行男性 nginx 自定义配置,所以我使用此代码创建名为 Procfile 的新文件

web: vendor/bin/heroku-php-nginx -C nginx_app.conf

和带有 nginx_app.conf 的新文件和这个代码

location / {
    # try to serve file directly, fallback to rewrite
    try_files $uri @rewriteapp;
}

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

location ~ ^/(app|app_dev|config)\.php(/|$) {
    fastcgi_pass heroku-fcgi;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS off;
}

所以在我的heroku应用程序目录中有两个文件夹作为yii(yii框架支持文件),第二个是文档根文件夹,我的应用程序在哪里所以我现在想要两个,我们必须在nginx_app.conf文件中声明文档根目录

4

1 回答 1

0

搜索后我解决了这个问题

web: vendor/bin/heroku-php-nginx // put your custom nginx file //space with folder name

并删除 index.php

location / {
    # try to serve file directly, fallback to rewrite
    try_files $uri @rewriteapp;
}

location @rewriteapp {
    # rewrite all to app.php
    rewrite ^(.*)$ /index.php/$1 last; //add here index.php
}

location ~ ^/(app|app_dev|config)\.php(/|$) {
    fastcgi_pass heroku-fcgi;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS off;
}

所以它将配置任何框架

于 2014-08-04T05:23:31.837 回答