没有input文件指定与嵌套的Docroot

我有以下nginxconfiguration2个不同的域名:

server { listen 80; root /srv/users/serverpilot/apps/myapp/public; index index.php index.html index.htm; server_name domain.com www.domain.com; location / { try_files $uri $uri/ @route; } location @route { rewrite ^/(.+)$ /index.php?_route_=$1 last; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/srv/users/serverpilot/run/myapp.php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } 

我在使用ServerPilot作为我的控制面板的DigitalOcean Ubuntu 14.04 x64液滴上。

ServerPilot应用程序的默认文档根目录是:

 /srv/users/serverpilot/apps/APPNAME/public 

在一个域中,我使用默认的docroot,这个nginxconfiguration工作正常,但在另一个应用程序中,我的实际文档根目录是:

 /srv/users/serverpilot/apps/myapp/public/public 

在这个我已经改变了根指令适当的,但我得到的是No input file specified. 错误。

我检查了权限,检查了我的池权限,并检查了该文件是否存在。

任何想法或帮助将不胜感激。

UPDATE

改变了这个configuration:

 server { listen 80; root /srv/users/serverpilot/apps/myapp/public; index index.php index.html index.htm; server_name my.domain.com; location / { rewrite ^/$ /public/ break; rewrite ^(.*)$ /public/$1 break; } location ~ .*\.(ico|gif|jpg|jpeg|png) { } location /public { rewrite ^/(.*)/$ /$1 redirect; if (!-e $request_filename){ rewrite ^/([^?]*) /index.php?_route_=$1 break; } } location ~ \.php$ { try_files $uri $uri/ /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/srv/users/serverpilot/run/myapp.php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } 

现在我得到了我的index.php预期,但没有CSS,JS或图像,并点击链接带我到404。

所以我正在接近,但仍然失去了一些东西。

UPDATE

从错误日志中,我可以看到为什么路由失败。 正在请求的路线有一个额外的斜线在这里:

 2015/04/29 11:16:06 [error] 9796#0: *7 open() "/srv/users/serverpilot/apps/myapp/public/public//common/css&css=50d5d2cdd10873f535b8f87c3c65e908" failed (2: No such file or directory), client: 127.0.0.1, server: my.domain.com, request: "GET /common/css&css=50d5d2cdd10873f535b8f87c3c65e908 HTTP/1.1", host: "my.domain.com", referrer: "http://my.domain.com/" 

而对于图像,它们不是通过public / directory路由的:

 2015/04/29 11:16:06 [error] 9796#0: *11 open() "/srv/users/serverpilot/apps/myapp/public/image/cache/data/blog/post/landscape-b-40x30h.jpg" failed (2: No such file or directory), client: 127.0.0.1, server: my.domain.com, request: "GET /image/cache/data/blog/post/landscape-b-40x30h.jpg HTTP/1.1", host: "my.domain.com", referrer: "http://my.domain.com/" 

更新:

经过大量的研究和查看其他服务器块为不同的应用程序,我想出了这个,但它仍然缺less一些东西。

 upstream backend { server unix:/srv/users/serverpilot/run/myapp.php-fpm.sock; } server { listen 80; root /srv/users/serverpilot/apps/myapp/public; index index.php index.html index.htm; server_name my.domain.com; access_log /srv/users/serverpilot/log/myapp/myapp_nginx.access.log; error_log /srv/users/serverpilot/log/myapp/myapp_nginx.error.log; location /public { try_files $uri $uri/ /public/index.php?_route_=$args; } location / { rewrite ^(.*)$ /public/$1; } location ~ \.php$ { include fastcgi.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_pass backend; } } 

剩下的唯一问题是每个PHP页面都返回主页。

链接工作在点击它们改变dom的历史,但同一页面加载每个请求。

 upstream myapp { server unix:/srv/users/serverpilot/run/myapp.php-fpm.sock; } server { listen 80; server_name my.domain.com; root /srv/users/serverpilot/apps/myapp/public; index index.php index.html index.htm; access_log /srv/users/serverpilot/log/myapp/myapp_nginx.access.log; error_log /srv/users/serverpilot/log/myapp/myapp_nginx.error.log; location /asset { rewrite ^/asset/(.*)$ /public/asset/$1 break; } location /image { rewrite ^/image/(.*)$ /public/image/$1 break; } location / { try_files $uri $uri/ @front; } location @front { rewrite ^/(.+)$ /index.php?_route_=$1 last; } location ~ \.php$ { include fastcgi.conf; fastcgi_pass myapp; } } 

谢谢你。