Articles of PHP

错误200#0:* 79在读取来自上游的响应标题时,在stderr中发送了FastCGI:“主脚本未知”

我想在我的MAC上configuration新的nginx,但我总是得到[error] 200#0: *79 FastCGI sent in stderr: "Primary script unknown" ..我不知道什么我做configuration错误。 这是我的nginx.conf文件: #user RobDee; worker_processes auto; #error_log logs/error.log; #error_log logs/error.log info; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format #main '$remote_addr – $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log; error_log logs/error.log; sendfile […]

nginx显示200正常状态,但不加载页面

我已经在我的ubuntu 16.04服务器上安装了nginx,php7.0-fpm和mysql。 一切工作正常但是它不加载phpmyadmin的设置页面。 下面是我的phpmyadmin nginx块。 location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/run/php/php7.0-fpm.sock; include fastcgi_params; } } 以下是我的nginx访问日志 /usr/share# tail -f /var/log/nginx/access.log 127.0.0.1 – – [15/Oct/2016:17:13:06 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0" 127.0.0.1 – […]

为什么Ubuntu的默认PHP 7.0.13几乎是ppa的两倍:ondrej / php PHP 7.0.15?

所以我的意图是真正的基准如何我们目前的应用程序生成的报告在php5,php7和php7-fpm。 我使用Ubuntu 16.04在DigitalOcean上启动了一个2gb实例,并安装了apache2和php7。 testing运行约9秒,并生成一个报告10次(ab -k -c 2 -n 10)。 然后我安装了ppa:ondrej / php并升级并再次运行(仍然在php7.0上,但现在从ppa)。 16秒的结果有点令人惊讶。 我切换到php5.6,它运行了18秒。 然后我清除了ppa,并从ubuntu的repo中恢复了php7,并在大约10秒钟内再次运行。 那为什么这么慢?

Nginx的根前缀与其他子文件夹?

我花了很多小时,看似简单的configuration,但我不知道正确的configuration:( 我有2个不同的应用程序,我必须服务2个不同的url。 这个应用程序下的所有东西都需要抓住所有的index.php。 示例:(公用URL =>服务path(应用程序)) https://example.com/ => /var/public/index.php https://example.com/xy => /var/public/index.php https://example.com/xy/zw => /var/public/index.php 但! https://example.com/api/v2 => /api/public/index.php https://example.com/api/v2/xy => /api/public/index.php https://example.com/api/v2/xy/test => /api/public/index.php 我也有Apache的反向代理configuration:(仅用于重写/ API / V2到/ api /公共,所以只有nginx / api /公共URI显示 – 反向代理需要,我只有1个公共IP,但许多网站) <VirtualHost *:443> ServerName xxx.com <Proxy *> Order deny,allow Allow from all </Proxy> SSLEngine On SSLCertificateFile /etc/apache2/cert/xxx.com.pem SSLCertificateKeyFile /etc/apache2/cert/xxx.com.key SSLCertificateChainFile /etc/apache2/cert/yyyy.pem […]

Nginx的Http安全链接模块不工作

我正在使用nginx secure_link来防止video从热链接。 如果主服务器密钥匹配远程服务器密钥。 video将能够访问/观看。 否则,如果用户访问链接直接没有MD5链接video返回403。 。 。 md5键匹配主键和远程键。 而服务器的时间是一样的。 。 。 主服务器(Apache)像这样生成链接。 http://remote_example.com/videos/myvideo.mp4?st=E_Jb6MScgyMqjUo3eNQGkA&e=1485757614 。 。 远程服务器nginxconfiguration。 “mypassword”与主服务器设置相同。 使用VestaCP面板的远程服务器。 location ^~ /videos/ { alias /home/admin/web/example.com/public_html/videos; secure_link $arg_st,$arg_e; secure_link_md5 mypassword$uri$arg_e; if ($secure_link = "") { return 403; # invalid hash or direct link } if ($secure_link = "0") { return 410; # link expired } mp4; gzip […]

Nginx:提供不同根目录下的magento站点以及其他magento根目录下的子目录

经过数小时的search和testing,我还没有得到这个工作。 我在/ srv / site1 / htdocs有一个正在运行的magento安装。 我在/ srv / site2 / htdocs有另一个magento安装。 我需要site2加载在site1.com/site2/。 棘手的权利? 到目前为止,我已经有site1.com/site2加载了一个无风格的404页面,用于site2 magento安装,这个目录里面的所有内容都会抛出一个404.下面是我的整个nginx conf: server { listen 80; server_name site1.com; root /srv/site1.com/htdocs; index index.php; client_max_body_size 500M; location ~ /site2 { root /srv/site2/htdocs; add_header Access-Control-Allow-Origin "*"; index index.php index.html; try_files $uri $uri/ /index.php?$args; expires 30d; location ~* \.php$ { try_files $uri =404; […]

漂亮的URL服务器端configuration?

我已经把一个网站转移到了我们的新VPS。 它在旧的服务器上工作得很好。 我想我知道是什么导致了这个问题,但不知道在哪里解决。 我已经阅读了很多关于漂亮url的post,似乎大部分都是使用mod_rewrite解决scheme。 看着我的.htaccess文件,它不是这样设置的。 它可能甚至不是漂亮的URL,完全叫做别的东西。 我们的VPS运行WHM / Cpanel 服务器版本: Apache / 2.4.25(cPanel)OpenSSL / 1.0.1e-fips mod_bwlimited / 1.4 Apache 2.4,PHP 5.5,PHP 5.6和PHP 7.0 CENTOS 7.3 x86_64 virtuozzo – 服务器WHM 62.0(内部版本16) 我遇到了URL和.htaccess的问题。 以下是当前.htaccess文件的内容: Options -All SymLinksIfOwnerMatch MultiViews #AllowOverride None Order allow,deny Allow from all DirectoryIndex index 当我去到网站时,我得到: 内部服务器错误 服务器遇到内部错误或configuration错误,无法完成您的请求。 请与网站pipe理员的服务器pipe理员联系,通知他们发生此错误的时间,以及您在此错误发生之前执行的操作。 有关此错误的更多信息可能在服务器错误日志中可用。 此外,尝试使用ErrorDocument处理请求时遇到500内部服务器错误错误。* 当我删除.htaccess文件中的一切,然后网站出现,但是当我点击一个链接说它没有find。 (在代码中,它不使用.php扩展名,所以它没有find页面。) 它在旧服务器上的工作方式是不使用.php扩展名。 所以,而不是http://www.example.com/make01.php它只是http://www.example.com/make01 […]

服务器达到MaxRequestWorkers设置

新的8 GB专用服务器在高峰时间和Apache error.log中停止工作,发现以下错误: [mpm_prefork:error] [pid 7565] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting [mpm_prefork:notice] [pid 7565] AH00169: caught SIGTERM, shutting down 该网站运行在PHP 7.1.2,Apache / 2.4.10(Debian),根据本教程安装的FPM / FastCGI 经过一番研究之后,我修改了/etc/apache2/mods-available/mpm_prefork.conf ,但仍然在服务器高峰期间出现故障并保持相同的错误。 mpm_prefork.conf的最后更新是: <IfModule mpm_prefork_module> StartServers 20 MinSpareServers 5 MaxSpareServers 10 MaxRequestWorkers 1024 ServerLimit 1024 MaxConnectionsPerChild 0 </IfModule> 这个问题让我担心的是,无论mpm_prefork.conf有什么值,大约6GB的Ram总是空闲的。 我假设一些文件覆盖/etc/apache2/mods-available/mpm_prefork.conf和服务器忽略这个文件,如果没有,那么我肯定写了不适当的设置。 您能否介绍一下如何configurationmpm_prefork.conf文件或者哪些文件可以覆盖这个文件?

php_value使用前端控制器覆盖Apache

我正在尝试为用于上传文件的虚拟path设置特定的服务器端值。 我所有的URL都是虚拟的,请求由前端控制器调度。 我在我的网站的唯一.htaccess文件中有以下configuration: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^ index.php [L] </IfModule> 由于upload_max_filesize不能用ini_set设置,我需要使用.htaccess文件或Apache .conf来覆盖这个设置。 考虑到我没有真正的文件/文件夹来放置.htaccess ,我认为唯一的方法是使用Apache .conf 。 我尝试了几种使用<LocationMatch> , <Location>甚至<FilesMatch>但是不知道如何使其工作。 下面是我的网站的vhost.conf样子: <LocationMatch "upload"> php_value upload_max_filesize 60M </LocationMatch> <Directory "/mysite/documentroot"> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> 我的理论是,因为我的网站使用一个单一的FrontController,在redirect后应用<Location>规则,所以不可能从Apache端做到这一点。 除非我错过了什么,解决这个问题的最好方法是请求PHP端的function改变,以允许使用ini_set改变这些设置?

Debian Jessie会话清除失败

最近我的一个Debian机器的inode被填满了,罪魁祸首竟然是/var/lib/php5/sessions ,累积了250万个临时会话文件,尽pipe每当文件超过24分钟时就应该清理掉。 Debian在PHP本地垃圾收集上采取措施,而是使用名为/usr/lib/php5/sessionclean来完成这项工作。 我的版本是2月8日,这应该是Debian Jessie的最新版本。 它正悄悄退出,但据我所知,什么都不做。 我正在查看代码,发现这一行: session_config=$(PHP_INI_SCAN_DIR=/etc/php5/${conf_dir}/conf.d/ php5 -c /etc/php5/${conf_dir}/php.ini -d "error_reporting='~E_ALL'" -r 'foreach(ini_get_all("session") as $k => $v) echo "$k=".$v["local_value"]."\n";')在所有运行最新Jessie的多台机器上保持一致。 据我所知,这是行不通的,永远不会工作,因为它试图运行/etc/php5/apache2/conf.d/ php5而不是/etc/php5/apache2/conf.d/php5 。 但是即使把它们放在一起,我也不断收到错误,这次是关于'-c'的选项。 任何有关如何使这项工作正确的想法,以及为什么现成的debian失败?