微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Nginx没有服务器子文件夹的API应用程序PHP-FPM

我有我的应用程序的以下文件夹结构

- css - app - js - ... - server (codeigniter) -- system -- application -- index.PHP - index.html (angularJS app)

这是我的Nginx.conf

server { listen 80; listen [::]:80; root /var/www/html/myapp.com/public_html; index index.html; server_name myapp.com www.myapp.com; location / { index index.html; } location /server/ { index /server/index.PHP; try_files $uri /server/index.PHP/$uri; } location /twitter/ { index /twitter/index.PHP; try_files $uri /twitter/index.PHP/$uri; } location ~ .PHP { fastcgi_split_path_info ^(.+?.PHP)(/.*)$; fastcgi_pass unix:/var/run/PHP5-fpm.sock; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } #deny access to .htaccess files,if Apache's document root #concurs with Nginx's one location ~ /.ht { deny all; } }

这是我不断得到的错误

2016/03/04 18:26:02 [error] 4577#0: *4 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.PHP (No such file or directory)" while reading response header from upstream,client: 127.0.0.1,server: myapp.com,request: "GET /server/api/users/isLoggedIn HTTP/1.1",upstream: "fastcgi://unix:/var/run/PHP5-fpm.sock:",host: "myapp.com",referrer: "http://myapp.com/" 2016/03/04 18:26:02 [error] 4577#0: *3 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.PHP (No such file or directory)" while reading response header from upstream,request: "GET /server/api/categories HTTP/1.1",referrer: "http://myapp.com/" 2016/03/04 18:26:03 [error] 4577#0: *3 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.PHP (No such file or directory)" while reading response header from upstream,request: "GET /server/api/products/latest/16 HTTP/1.1",referrer: "http://myapp.com/"

页面正确显示,我只是可以达到子文件夹中的api资源。 你能帮我解决我在做什么错吗? 如果您需要任何其他信息,请让我知道,我会提供

独angular兽工人超时

Angular应用程序URL与Nginx 403错误的应用程序目录内的实际目录path冲突

HTTP请求在应用程序中占用太多的时间,但在网站中less

Laravel + AngularJS Nginx路由

Dockerize您的Angular NodeJS应用程序

谢谢

与Apache的AngularJS路由问题

NGIX为AngularJS HTML5模式configuration模板和资产

多个htaccess重写条件/angular路由html5模式

Angular – UI路由器路由 – HTML5模式

Angularjs选项值在select框中的Windows平板电脑(IE浏览器)中不显示

基于user @ semm0( 链接 )这可能是一个权限问题,可能是由AppArmor引起的。 请查看此答案以查看可能的解决方案。 我不想窃取答案,因此连接到它。

编辑:问题可能现在发生在PHP-fpm配置。 请用你最喜欢的编辑器打开/etc/PHP5/fpm/pool.d/www.conf ,取消注释如下:

listen.owner = www-data listen.group = www-data listen.mode = 0660

不要忘记重新启动PHP服务器:

service PHP5-fpm restart

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐