Articles of PHP的

Nginx重写问题

请求的每一页都被传递给“check.php”: rewrite ^/(.*)$ http://localhost/check.php?page=$1 “check.php”validation几个安全的东西,然后需要请求的页面: <?php // … security stuff require_once ($myRequestedPage); ?> 问题是,在HTML文件中,没有加载任何外部样式,只是脚本: <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!– Do not load –> <link href="css.css" rel="stylesheet" type="text/css" /> <!– Do not load –> <script src="js.js"></script> <!– Load –> <style> @import url("css.css"); <!– Do not load –> </style> <title></title> </head> <body></body> […]

file upload/移动temp不能在nginx上工作

所以,我读了关于move_uploaded_file()问题的这个问题。 但是,在我的apache驱动localhost灯栈,其工作就好了。 所以我认为这可能是一个文件系统/path的事情,而不是代码的事情。 当上传文件到我的网站本地,它的工作原理。 但是当我在QA服务器(这是nginx供电),我得到这个错误: 2012/09/08 15:34:21 [error] 11794#0: *5187 FastCGI sent in stderr: "files not empty PHP Warning: move_uploaded_file(/var/www/qa.mysite.com/mysite/app/files/maps-aprilfools.tiff): failed to open stream: No such file or directory in /var/www/qa.mysite.com/mysite/app/models/files.php on line 516 PHP Warning: move_uploaded_file(): Unable to move '/tmp/phpvdtznP' to '/var/www/qa.mysite.com/mysite/app/files/maps-aprilfools.tiff' in /var/www/qa.mysite.com/mysite/app/models/files.php on line 516" while reading response header from upstream, client: […]

nginx连接限制

我们有2个nginx服务器,在3个使用TCP连接的php5-fpm服务器前,总共运行1000reqs /秒。 我们认为一个nginx服务器就足够了,并将所有的stream量redirect到它。 但是,服务器不能超过750reqs /秒。 它有千兆以太网和总stream量不超过100mbits(Debian 6.0) 我们找不到任何理由,Googlesearch后发现它可能与TCP问题有关。 但是我们不应该用这个连接数和带宽做任何改变(大约70mbits / sec)。后来我们把一半的stream量redirect到另一个nginx,并且再次达到了1000reqs /秒。 我们一直在看nginx错误和访问日志。 有什么工具或文件可以帮助我们find问题的解决scheme吗?

Nginx禁止在Magento上传目录中执行PHP

我很难让nginx在magento安装的上传目录中停止执行PHP。 我已经尝试了很多指令的组合,当* .php匹配那个目录时,它应该发送一个503或者类似的命令,但是我仍然可以在那里执行PHP。 当然,代码解决scheme是防止.php文件被上传,但我不明白如何从nginx的angular度来防止执行。 map $http_x_ssl_offloaded $fastcgi_https { default off; on on; } server { listen 80; server_name store.xxxx.com; root /var/www/store.xxxx.com; #charset koi8-r; #access_log /var/log/nginx/store.xxxx.com-access.log main; access_log /var/log/nginx/store.xxxx.com-access.log; error_log /var/log/nginx/store.xxxx.com-error.log; gzip on; gzip_disable msie6; gzip_static on; gzip_comp_level 9; gzip_proxied any; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; location / { index index.html index.php; try_files […]

在Nginx设置页面上安装Magento 2.0.2不起作用

需要一些帮助安装Magento 2.0.2在nginx 1.9.3与php-fpm目前我使用Magento提供的默认configuration( https://github.com/magento/magento2/blob/develop/nginx.conf.sample )。 发生这个问题的时候是在解包之后访问/设置时,我在“setup / index.php / navigation”上看到了一个403,以及页面试图访问的其他URL。 我已经意识到这背后的问题是,它不是作为一个parameter passing到“index.php文件”,实际上是寻找“index.php /导航”作为一个文件,并试图将其传递给php5-fpm导致security.limit_extensions被触发,导致403。 所以问题变成如何得到正确处理的请求? EX时,由设置index.php呈现的JavaScript请求index.php /导航如何确保它作为parameter passing给index.php而不是试图在“index.php /导航”查找文件,如果索引.php是一个目录。

Docker – 安装php-memcached extenstion不工作?

我一直试图安装memcached在我的php-5.6容器,但是我无法得到它的工作,因为我没有看到在phpinfo()memcached扩展和加上由于某种原因,它的compcomping它不能findmemcache.so代码。 有我的docker文件为PHP构build FROM php:5.6-fpm RUN apt-get update && apt-get install -y \ libfreetype6-dev \ libjpeg62-turbo-dev \ libmcrypt-dev \ libpng12-dev \ && docker-php-ext-install -j$(nproc) iconv mcrypt \ && docker-php-ext-configure gd –with-freetype-dir=/usr/include/ –with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd RUN docker-php-ext-install mysqli mbstring pdo_mysql # Download and Installing php libraries RUN apt-get install -y memcached RUN apt-get -y […]

使用nginx进行.htaccess身份validation

我的configuration有一些问题。 我使用Nginx作为我的Apache服务器的反向代理。 我的网站有.htaccessauthentication,但Nginx似乎并不理解,所以我得到一个404错误。 我在其他答案上看到了一些翻译,但是并没有翻译这部分。 AuthUserFile /var/www/mywebsite/private/.htpassword AuthName "Acces Restreint" AuthType Basic Require valid-user 顺便问一下,你对第二部分的翻译有什么想法吗? php_value session.gc_maxlifetime 604800 SetEnv APPLICATION_ENV development 感谢大家的帮助!

nginx PHP与wordpress在根目录和另一个应用程序在子目录中

我有一些问题得到一个子目录在我的nginx服务器上工作。 我正在使用nginx来提供一个WordPress的安装作为网站的根,并试图在一个子目录下运行一个额外的PHP应用程序。 WordPress的运行良好,但我不能为我的生活让应用程序运行在子目录中没有404,403,或“没有指定的input文件”。 错误与各种configuration。 我确信有一些明显的东西,但我似乎无法弄清楚! 这里是相关的configuration: 任何帮助将不胜感激! server { listen myserver.edu:8081; server_name myserver.edu:8081; try_files $uri $uri/ /index.php; location / { root /path/to/nginx/html/wordpress; index index.php; } location /stacks { alias /another/path/to/usr/local/share/stacks/php; index index.php; } location ~ \.php$ { set $php_root /path/to/nginx/html/wordpress; include fastcgi_params; fastcgi_pass localhost:8082; fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name; } location ~ \stacks.php$ { set $php_root /another/path/to/usr/local/share/stacks/php; […]

FastCGI在stderr中发送:“主要脚本未知” – nginx和silex

我在部署Silex项目的服务器上收到此错误。 在这个服务器中,我已经有了nginx将请求从/传送到在端口5000上运行的Flask应用程序。 所以,从我的资源/var/www/newproject新项目到/var/www/newproject我试图configurationnginx,以便http://xxx.xxx.xxx.xxx/newproject的请求将根目录到/var/www/newproject哪是一个silex应用程序。 我search了networking,我发现所有的configuration不能解决我的问题。 访问任何路线,返回404。 我的整个configuration是这样的: server { listen 80; server_name xxx.xxx.xxx.xxx; access_log /var/log/myproject/nginx_access.log; error_log /var/log/myproject/nginx_error.log; proxy_connect_timeout 300s; proxy_read_timeout 300s; location /newproject { root /var/www; try_files $uri $uri/ =404; index index.php; fastcgi_pass unix:/var/run/php5-fpm.sock; #fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/newproject/index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; #fastcgi_param SCRIPT_FILENAME /var/www/newproject$fastcgi_script_name; include fastcgi_params; } location / { root /opt/myproject; […]

在cloud9环境中运行一个自定义的networking服务器,并从外部接触到它

是否有可能从另一台服务器运行我的Web应用程序而不是在cloud9提供的服务器? 例如:我想用nginx作为后端服务器(i)和/或反向代理(ii)(尝试不同的场景和configuration选项)运行不同的应用程序(PHP,Node.js – 不知道可能是什么) 。 是否有可能在cloud9上运行nginx并向外界提供内容? 是否有可能有nginx作为cloud9中的反向代理? 编辑: 他们在这里写道: $ PORT暴露于外部:当您运行侦听环境variables$ PORT中指定的端口的应用程序时,可以使用http://projectname.username.c9.io URLscheme访问此应用程序。 代理期望该端口上的服务器是HTTP服务器。 其他协议不受支持。 这导致我相信,如果我将启动nginx的端口= $ PORT它将通过指定的URL访问她 – 任何人都可以确认? 也许任何人都试过这个,可以分享一些省时的技巧。 谢谢。