Articles of PHP的

dynamicurl段的Nginx位置块

我的PHP应用程序自动检测到请求路由到pipe理区域通过关键字pipe理在URL即: http://example.com/manage 这个目录实际上不存在。 请求应该路由到index.php文件,这个文件在最初的请求pipe理/ /但是任何链接产生一个“没有指定的input文件”。 nginx错误。 我需要一个位置块,将工作在一个不存在的网段。 我试图重新写入主索引文件,如下所示: location /manage { try_files $uri $uri/ @back; } location @back { rewrite ^/manage/(.*)$ /index.php?_route_=$1 last; } 对Apache来说工作正常,但是在Nginx中这会产生一个500错误。 任何build议,将不胜感激。 更新: 完整configuration请求评论: 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/(.*)$ […]

Docker-compose Nginx php-fpm文件未find

我有一个简单的docker-composeconfigurationphp-fpm和nginx,我看不到任何php文件。 当我去本地主机,它显示文件未find。 我尝试了一切,我可以在网上find,但我所尝试的一切都失败了。 它工作正常的HTML,但不是PHP文件。 似乎是一个path问题,或类似的东西。 我在docker-compose logs遇到这个错误: project3-php_1 | 172.17.0.5 – 29/Mar/2016:13:29:12 +0000 "GET /index.php" 404 project3-front_1 | 172.17.0.1 – – [29/Mar/2016:13:29:12 +0000] "GET / HTTP/1.1" 404 27 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36" project3-front_1 | 2016/03/29 13:29:12 [error] 8#8: *3 FastCGI sent in stderr: "Primary script unknown" while reading […]

webserver和cgi进程如何相互通信?

我想了解Web服务器(例如:nginx)和cgi / fastcgi如何相互通信。 webserver如何将cgi脚本传递给cgi进程,以及cgi进程如何响应请求。 在Nginx中,我们像这样configuration让nginx将PHP脚本传递给php-fpm location / { root /home/service/public_html; fastcgi_pass unix:/tmp/php-fpm-test.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/service/public_html/index.php; include fastcgi_params; } 它是如何工作的? 编辑:这将不胜感激,如果有人可以给我一个伪代码来描述一个进程(或其他)和php-fpm unix套接字之间的通信。

laravel Redirect :: to()失去了端口

我通过vagrant(Ubuntu,nginx,php-fpm)运行我的开发环境并访问localhost:8080上的服务器。 我正在使用Laravel 4并尝试设置我的身份validation系统。 看来Laravel只是忽略了你使用的端口,如果你正在使用另一个端口。 这是真的? 例如,当我运行从http://localhost:8080/loginredirect到/profile我最终在http://localhost/profile 。 有没有人有任何build议,我如何修复/修补这个?

简单的docker – 与两个服务组成:nginx和php

我开始与Docker和nginx ,我试图设置一个两个容器环境运行: nginx:latest一面 php:fpm在另一边的php:fpm 我遇到了php-fpm的麻烦:我总是得到一个502错误的网关错误。 我的设置很简单( $TEST_DIR是我的工作目录)。 我的Docker组合configurationTEST_DIR/docker-compose.yml : nginx: image: nginx ports: – "8080:80" volumes: – ./www:/usr/share/nginx/html – ./conf/nginx.conf:/nginx.conf – ./logs/nginx:/var/log/nginx links: – php:php command: nginx -c /nginx.conf php: image: php:fpm ports: – "9000:9000" volumes: – ./www:/var/www/html nginxconfiguration$TEST_DIR/conf/nginx.conf : user nginx; worker_processes 1; pid /var/run/nginx.pid; events { worker_connections 2048; multi_accept on; use epoll; } […]

502坏的网关:nginx,php5-fpm,175/209连接()失败(111:连接被拒绝),当连接到上游

在Debian Jessie机器上用nginx和php5-fpm运行shopware 5,我们经常得到一个502 Bad Gateway 。 这种情况主要发生在后端,当更长的操作像缩略图创build一样工作时,即使这是在单个的ajax请求的小块内完成的。 使用的64 GB内存和16个内核的服务器根本就没有任何stream量。 除非我们已经修复了像这样的所有错误,否则我们现在像使用分级系统一样使用它。 错误日志: 在nginx错误日志中,可以find以下几行: [error] 20524#0: *175 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: domain.com, request: "POST /backend/MediaManager/createThumbnails HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com", referrer: "http://www.domain.com/backend/" [error] 20524#0: *175 no live upstreams while connecting to upstream, client: xx.xx.xx.xx, server: domain.com, request: "POST /backend/Log/createLog […]

Socket.io无法在nginx + node.js + php应用程序中连接

我试图与PHP应用程序和node.js一起运行nginx(这部分工作正常)。 另外我想添加socket.io到这个设置,但不幸的是我不能build立客户端和服务器之间的连接(看起来像连接超时?)。 server.js var app = require("http"), redis = require("redis"), io = require('socket.io')(app); io.sockets.on( 'connection', function( client ) { console.log( "New client !" ); io.sockets.emit('msg', { msg: 'Foo bar' } ); }); app.createServer().listen(3000); console.log("Server running at 127.0.0.1:3000"); client.js <script src="https://cdn.socket.io/socket.io-1.4.5.js"></script> <!– <script src="/js/socket.io-client/socket.io.js" type="text/javascript"></script>–> <script> var socket = io.connect('http://localhost:3000'); socket.on('msg', function(msg) { alert('News from server: […]

Laravel + AngularJS Nginx路由

我有以下问题,我需要configurationNginx,所以任何URL用户访问,它将保持uri(例如domain.com/some/url/ ),但只传递给laravel,并让Angular处理路由。 Route::get('/', function(){ return view('index'); }); 而当访问/api/{anything} Laravel将踢。 现在我从公共文件夹返回index.html ,直到find解决scheme这里是我的configuration: location / { index index.html; try_files $uri $uri/ /index.html; } location /api { index index.php; try_files $uri $uri/ /index.php?$query_string; } 我知道我可以做一个像这样的路线: Route::get('{anything?}', function(){ return view('index'); }); 但是要广泛。 更新: location / { rewrite ^/(.*)$ / break; index index.php; try_files $uri $uri/ /index.php; } location /api […]

无法访问位于nginx站点文档根目录之外的PHP文件

我有一个基于CodeIgniter的PHP应用程序。 我有一大部分的网站(系统文件夹给任何知道CodeIgniter的人)坐在文档根下面。 这里是网站的Nginx conf server { server_name www.domain.local; root /var/www/html/domain/frontend; include /etc/nginx/conf.d/ci_vhost; } 这里是我尝试访问/var/www/html/ci/2.0.2/system问题所在的文件夹 使用Apache,我从来没有遇到过在文档根目录下访问php文件的问题。 有谁知道我为什么遇到与Nginx的这个问题? 谢谢。

如何debuggingnginx / php-fpm的网站挂起?

我需要一些关于如何debugging挂起的新服务器configuration的提示。 这个网站本身是Drupal的一个非常大的实例。 在APC运行的情况下,每页加载的内存大小为45+ MB。 该网站本身在另一台服务器上运行nginx / php-fpm / apc。 我设置的新服务器有一个自定义的PHP 5.3版本。 nginxconfiguration为侦听端口80,并将fastcgi请求传递给127.0.0.1:9000。 这工作。 在Drupal的根目录下,我有一个普通的PHP文件phpinfo(); 在里面。 我可以直接加载这个PHP文件,并确认PHP的构build看起来不错。 没有nginx错误,但是php-fpm错误日志会在页面挂起时显示: [22-Dec-2012 17:41:16]警告:[pool www]子19760,脚本'/var/www/mysite/public_html/index.php'(request:“GET /index.php”)执行太慢(5.068781秒),伐木 除了这个错误之外,什么也没有。 所以我正在寻找方法debugging的build议,考虑到正常的PHP脚本加载罚款,但加载Drupal应用程序(直接到index.php,甚至没有尝试干净的url)挂起。