我有这个应用程序工作在一个标准的LAMP堆栈,但当我试图运行它在docker nginx php-fpm我得到一个错误(使用richarove/nginx-php-fpm. docker容器)。
编辑:此容器在同一容器中运行nginx和php fpm。
http://ip-vm/sistema/index.php/gui/gui/login
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
#server_name localhost;
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
sendfile off;
# Add stdout logging
error_log /dev/stdout info;
access_log /dev/stdout;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
index index.php;
try_files $uri $uri/ /sistemavtr/index.php/$args;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_read_timeout 120;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
expires 5d;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
这是标准输出错误:
2016/04/13 23:23:13[错误]20#0:*6内部重定向到“/sistema/index.php/”时的重写或内部重定向周期,客户端:192.168。139.1,服务器:,请求:“GET/sistema/index.php/gui/gui/login HTTP/1.1”,主机:“192.168.139.132”
192.168.139.1--[13/Apr/2016:23:23:13 0000]"GET /sistema/index.php/gui/gui/loginHTTP/1.1"500 594"-"Mozilla/5.0(Windows NT 10.0; Win64; x64)AppleWebKit/537.36(KHTML, like Gecko)Chrome49.0.2623.112Safari /537.36"
所以,我不确定是PHP Codeigniter App ExtJS的问题,还是URL模式(index.php/gui/gui/login)什么是不工作。
所以,最后的问题是default.conf.
使用这个问题作为配置指南,我终于做到了:Nginx不服务于子文件夹api应用程序(php-fpm)
因此,启用了my/etc/nginx/sites/default。最后是这样的:
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
#server_name localhost;
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
sendfile off;
# Add stdout logging
error_log /dev/stdout info;
access_log /dev/stdout;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location /sistema/ {
index /server/index.php;
try_files $uri /server/index.php/$uri;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
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;
fastcgi_read_timeout 120;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
expires 5d;
}
# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}
我不太清楚这到底是怎么回事,所以,这是我如何使它工作的,但如果有人能向我解释这一点,我将非常感激。
您的nginx配置,fastcgi的一部分
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_read_timeout 120;
}
您的配置试图将php代理到unix套接字,而不是9000端口。
应该是fastcgi\u pass unix:/var/run/php5 fpm。袜子
更改为
fastcgi\u pass 127.0。0.1:9000
下一个尝试观看php fpm配置,在那里您应该可以找到侦听端口。
最后,如果您使用docker,请确保所有docker主机都可以相互访问
UPD1:看起来
. htaccess
也可能有问题-例如,可以为特定主机保存apache规则-重定向。PHP-FPM不会读取该文件并忽略它。
UPD 2:
。htaccess
可以在PHP web根文件夹(index.PHP所在的位置)中找到
使用 I/O 重定向可以同时解析和固定命令输出的片段(see 样例 15-7). 这也使得可以生成报告和日志文件. 样例 20-12. 日志记录事件 #!/bin/bash # logevents.sh # 作者: Stephane Chazelas. # 用于 ABS 许可指南. # 事件记录到文件. # 必须 root 身份执行 (可以写入 /var/log). ROOT_UID=0
问题内容: 您好,我收到了我的应用程序出现以下错误的问题: 现在我不知道为什么它这么慢,并得到错误,该网站唯一要做的就是打开php文档并启动bash命令。:(所以它应该只重定向1次 谢谢 :) 我将使用应用程序中的按钮打开灯: 编辑: 现在我正在使用: 但是出现以下错误: 问题答案: 您的Android代码完美无缺- 这是服务器无法发挥作用的原因。首先,检查您正在调用正确的URL并传递正确的参数。
我使用ASP. NET Core 3.1 Blazor网络组装应用程序(Visual Studio 2019创建的默认应用程序)。 我连接了ASP。NET标识用于用户管理,添加了脚手架标识项(登录、注册等) 当我单击“注册”时,应用程序会正确重定向到 但是如果我单击登录,应用程序会重定向到 这是错误的(我希望<代码>https://localhost:44349/Identity/Account/
问题内容: 我有一个网页。该网页将用户重定向到另一个网页,或多或少通过以下方式: 好吧,您知道,我要做的是将GET参数转换为POST参数。不要告诉我这很不好,我知道我自己,这也不是我真正要做的,重要的是我从数组中收集数据并尝试通过POST将其提交到另一个页面。但是,如果用户关闭了JavaScript,它将无法正常工作。我需要知道的是:有没有一种方法可以通过PHP传递POST参数,以便重定向也可以通
问题内容: 我想使用PHP将所有www.domain.com请求重定向到domain.com,基本上是: 但是我确实想像SO中那样维护请求的URL,例如: 应该重定向到: 我不想依靠解决方案,并且我不确定要使用哪种变体来实现这一目标。同样,保留HTTPS协议将是一个加号。 我应该怎么做? 问题答案: 将用户重定向到完全相同的页面,www。完整。 因此,要摆脱www。,我们只需替换一行: 那应该起作
初学程序员,请原谅无知 我试图阅读某个OAuth 2.0服务的教程,但我不明白这个重定向URI...在我的特定环境中,假设我正试图构建一个使用OAuth 2.0的iPhone应用程序来提供一些服务。我有一个生成的应用程序ID,但我需要提供某种重定向URI来生成API密钥。 这是我应该自己托管在某个地方的URL吗?顾名思义,我认为重定向URL应该将某人“重定向”到某个地方。我唯一的猜测是,这是用户在