Nginx Yii2configuration在不同的文件夹中

我在为yii2基本应用程序configurationNginx服务器时遇到了问题。

这是我的服务块文件

server { listen 80 ; access_log /var/log/Nginx/access-server.log; error_log /var/log/Nginx/error-server.log; charset utf-8; location /fetch { root /usr/share/Nginx/html/another_folder/web/; try_files $uri $uri/ /index.PHP$is_args$args; } location ~ .PHP$ { fastcgi_split_path_info ^(.+.PHP)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }

我的项目位于另一个文件夹“another_folder”。 而我想当用户去url: http:// ip / fetch文件Nginx将提供另一个文件夹中的文件

我的错误日志文件返回给我:

用django,Nginx和gunicorn缺less自定义标题

有用的Linux内核debugging选项打开

一个Nginxconfiguration文件的格式化器/美化器?

哪里可以存储用于Python脚本的Windowsconfiguration文件

如何覆盖一些PHP认configuration?

2017/02/11 12:38:52 [error] 4242#0: *12 FastCGI sent in stderr: "Unable to open primary script: /usr/share/Nginx/html/index.PHP (No such file or directory)" while reading response header from upstream

和兄弟显示:没有指定input文件

你能帮我解决这个问题吗?

谢谢!

连接拒绝Postgresql服务器

我的应用程序/服务应在哪里存储它的configuration文件在Windows中?

如何stored procedures设置?

Mono和MKBundle的.NETconfiguration系统依赖关系

如何在CGI模式下运行时重写PHPconfiguration

除了您的评论,任何以/fetch开头的URI与别名路径中的静态文件不匹配,都应该被重定向到/fetch/index.PHP

location ^~ /fetch { alias /usr/share/Nginx/html/another_folder/web; if (!-e $request_filename) { rewrite ^ /fetch/index.PHP last; } location ~ .PHP$ { if (!-f $request_filename) { return 404; } include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_pass 127.0.0.1:9000; } }

由于这个长期问题,我们避免使用alias try_files 。

请参阅有关使用if 警告 。

相关文章

HashMap是Java中最常用的集合类框架,也是Java语言中非常典型...
在EffectiveJava中的第 36条中建议 用 EnumSet 替代位字段,...
介绍 注解是JDK1.5版本开始引入的一个特性,用于对代码进行说...
介绍 LinkedList同时实现了List接口和Deque接口,也就是说它...
介绍 TreeSet和TreeMap在Java里有着相同的实现,前者仅仅是对...
HashMap为什么线程不安全 put的不安全 由于多线程对HashMap进...