草庐IT

Linux-Nginx

全部标签

php - 如何为官方 nginx Docker 镜像使用自定义 Nginx 配置?

我有下一个docker-compose文件:nginx:build:.ports:-"80:80"-"443:443"links:-fpmfpm:image:php:fpmports:-"9000:9000"Dockerfile命令列表是:FROMnginxADD./index.php/usr/share/nginx/html/#ChangeNginxconfighere...Nginx服务器工作正常,我可以在http://localhost/index.html上看到默认的html页面,但不执行PHP脚本。所以当我得到http://localhost/index.php-浏览器下载P

php - nginx: [emerg] "location"指令在/etc/nginx/conf.d/default.conf:1 中不允许

我刚开始在AWSAMI实例上使用Nginx,但遇到了一些启动问题。我已点击此链接安装php-fpm和nginxhttps://gist.github.com/sumardi/5559803除了,我不需要mysql,所以我没有运行这个命令sudoyum-yinstallmysql-servermysql我的/etc/nginx/conf.d/default.conf看起来像这样:location/{root/var/www/html;indexindex.phpindex.htmlindex.htm;}location~\.php${fastcgi_passunix:/var/run/p

php - Nginx 为静态文件代理不正确的 fastcgi_script_name

server{listenloc.app:80;root/app/frontend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_args$args;}location~^/admin{proxy_passhttp://127.0.0.1:81;}location~*\.php${#phpconf}}server{listen127.0.0.1:81;root/app/backend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_arg

php - 在 Docker 中通过 Nginx 的多个版本的 PHP

我为PHP5.6运行了两个docker容器:dockerrun--namephp5\-v/html1:/var/www/html/site1\-d-p9001:9000php:5.6-fpm对于PHP7:dockerrun--namephp7\-v/html2:/var/www/html/site2\-d-p9000:9000php:7-fpm我用Nginx运行Docker容器:dockerrun--namenginx-cache\-v/nginx.conf:/etc/nginx/nginx.conf\-v/nginx/html1:/var/www/html/site1\-v/ngin

php - 如何使用 Docker 在 Alpine Linux 上部署 Laravel Web 应用程序?

我正在使用来自PHP的基础镜像在ECS上成功部署LaravelWeb应用程序,特别是来自https://hub.docker.com/_/php/的7.3-apache-stretch充分了解有关AlpineLinux的讨论Docker中的图像(最终图像尺寸显着减少),我想试一试,看看它的表现如何。不幸的是,虽然使用CLI版本非常容易(使用7.3-cli-alpine3.9),但没有启用apache的版本。我需要的是一个Dockerfile作为我开发的基础。仅限Apache浏览SO,我找到HowdoIrunApache2onAlpineinDocker?这引起了我的注意https://

php - 处理拆分 Windows 或 Linux 路径的最佳方法

我有两个字符串:C:\Users\Bob\MyDocuments/Users/Bob/Documents我已经想出了这个正则表达式:preg_split('/(?会返回Array([0]=>C:\[1]=>Users\[2]=>Bob\[3]=>MyDocuments)Array([0]=>/[1]=>Users/[2]=>Bob/[3]=>Documents)不过,我正在寻找Array([0]=>C:\[1]=>Users[2]=>Bob[3]=>MyDocuments)Array([0]=>/[1]=>Users[2]=>Bob[3]=>Documents)即尾部斜杠不存在于更正的

php - 如何在 Nginx 配置文件中配置 Phalcon

我正在尝试设置NGINx服务器以使用PhalconPHP框架。到目前为止,我一直在互联网上寻求帮助,但找不到任何东西......我的配置文件是:server{#listen80;##listenforipv4;thislineisdefaultandimplied#listen[::]:80defaultipv6only=on;##listenforipv6root/usr/share/nginx/www;indexindex.phpindex.htmlindex.htm;#Makesiteaccessiblefromhttp://localhost/server_namelocalh

php - json_encode 在 Windows 上返回整数值,在 Linux 上返回字符串

我最近遇到了这个奇怪的问题。我目前正在Windows环境中进行开发,同时在Linux服务器上进行部署,我知道这并不理想,但现阶段我对此无能为力。我所做的只是从数据库中获取数据,然后返回结果数组的JSON响应,但结果不同导致我的前端应用出现问题。我在Windows上得到这个:{"id":40,"name":"test"}在Linux上是这样的:{"id":"40","name":"test"}我实际上使用的是Laravel框架,所以语法很简单:$user=User::find($id);returnResponse::json($user->toArray());在幕后做这件事的是:$t

PHP Nginx error_log 被截断

我正在运行nginx和PHP5.5,当传递的字符串很长时,我所有的error_log消息都会被截断。我已经更新了我的php.ini文件并将日志最大长度从1024增加到0(无最大值)并且它仍在发生。 最佳答案 如果你想要超过2048字节的日志行,你需要重新编译Nginx。来自http://wiki.nginx.org/HttpLuaModule:Nginx核心中的错误消息有硬编码的长度限制。最多2048字节,包括尾随换行符和前导时间戳。您可以通过修改Nginx源代码树中src/core/ngx_log.h文件中的NGX_MAX_ERR

Nginx 别名指令不适用于 php

我有一个在Nginx上运行的应用程序,它的工作服务器block如下所示:server{listen80;server_nameexample.com;root/home/deployer/apps/my_app/current/;indexindex.php;location/{indexindex.php;try_files$uri$uri/;}location~\.php${try_files$uri=404;fastcgi_split_path_info^(.+\.php)(/.+)$;fastcgi_passunix:/home/deployer/apps/shared/php