我有一个问题让nginxconfiguration工作。 似乎一切工作正常,但我的PHP脚本不会收到GET参数。 我得到的最相关的链接是这一个nginx + php-fpm – 我的$ _GET参数在哪里? 但是我的configuration稍有不同,只需在最后一个try_files指令中添加$ query_string就行不通了。 这是我的configuration: server { server_name api.example.com; root /home/example/api/web; location /v2 { alias /home/example/api/v2/web; try_files $uri /v2/index.php; location ~* \.(js|css|less|png|jpg|jpeg|gif|ico|woff|ttf|svg|tpl)$ { expires 24h; access_log off; } location /v2/index.php { fastcgi_index index.php; fastcgi_pass php56; fastcgi_split_path_info ^/v2/(.+\.php)(.*)$; fastcgi_param SCRIPT_FILENAME /home/example/api/v2/web/$fastcgi_script_name; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_NAME /v2/index.php; } } } 然后使用这个configuration, […]
您可以从当前环境中检索variables的FPMconfiguration统计信息。 然而,在使用Nginx和PHP-FPM的ubuntu上,我找不到从环境中检索variables值的方法, 而无需在php-fpm.conf或nginx fcgi params中对它进行硬编码 。 有没有办法从/ etc / environment或/etc/bash.bashrc获取环境variables? 例如: clear_env = no ENV[SECRET_TOKEN] = $SECRET_TOKEN 我认为主要的问题是无法修改www-data的环境variables。 as >sudo -H -u www-data bash -c "env"不包括SECRET_TOKEN 。
我在这里看到了一堆关于这个问题的问题,但是没有一个答案帮助我。 我不断从nginx得到一个502错误,所以我看看access.log,看到当服务器试图连接到unix:/var/run/php5-fpm.sock时,我不断收到错误111 unix:/var/run/php5-fpm.sock 我已经重新启动php5-fpm,并确保套接字实际上在那里,但我一直得到这个错误。 你们知道为什么吗? 我的nginx.conf user www-data www-data; worker_processes auto; error_log /var/log/nginx_error.log; pid /run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; gzip on; gzip_disable "msie6"; access_log /var/logs/nginx/access.log; error_log /var/logs/nginx/access.log; server { listen 80 default_server; root […]
关于这个问题也有类似的问题,但是在这个问题上似乎没有任何亮点。 我在Ubuntu 14.04上使用PHP 5.6.18。 它的服务器是一个8核心CPU(不确定的确切型号)和8 GB的RAM的办公室服务器。 这台服务器的运行时间差不多有2.5年左右,我已经做了维护,最初是在Ubuntu 12.04上使用旧版本的php,但是随着时间的推移,升级了它。 我最后一次更新是在6个月前,没有问题。 一般设置是nginx将请求传递给apache以进行cms开发,并且我们有各种工作应用程序直接运行在nginx之外。 然而在过去的几天里,PHP-FPM(CLI / APACHE PHP工作正常)似乎每隔5分钟就会崩溃,有时会持续更长的时间,甚至通常在一夜之间罚款。 服务器本身没有负载,日志只显示php超时请求,然后不会处理任何进一步的请求,直到重新启动。 奇怪的是最近没有对服务器做任何事情,这只是在3天前随机启动,没有明显的原因。 所有的努力(重新php / mysql,重新启动整个服务器等)已经失败。 这里是我的主要nginxconfiguration的一部分(我已经多次改变这些值现在尝试各种各样的东西,现在大多数是禁用)。 #client_header_timeout 600; #client_body_timeout 600; #fastcgi_read_timeout 600; client_max_body_size 2048m; #fastcgi_buffers 8 4k|8k; #fastcgi_buffers 8 128k; #fastcgi_buffer_size 128k; #client_max_body_size 2048M; send_timeout 900; #fastcgi_read_timeout 3000; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; […]
我正在寻找关于如何设置mod_proxy_fcgi和chrooted php-fpm的最新指令。 除了chroot部分,我整个过程都成功了。 我试图使用最先进的设置,对我来说这是通过使用unix域套接字的“Proxy via Handler”方法,如http://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html所述 。 我没有发布任何configuration的详细信息,只是要求任何通用的指令或如何做到这一点的例子(我的错误当然是“AH01071:有错误'主脚本未知\ n'”)。 所有我能find的是nginx的说明,apache与mod_fastcgi等。 thx任何提示
我有一个运行Apache + PHP-FPM + FastCGI的Ubuntu 14.04服务器,为用户主页提供服务。 为了安全起见,我在Apache的configuration中启用了: Header set X-Content-Type-Options: "nosniff" Header set X-Frame-Options: "sameorigin" Header set X-XSS-Protection: "1; mode=block" AllowOverride FileInfo已设置,因此用户可以在.htaccess文件中使用Header指令进行更多控制(如果需要的话)。 然而,似乎Apache没有兑现当CGI使用PHP( mod_headers没有发送标题时,文件是PHP ),即使Header always , .htaccess Header命令被忽略的PHP文件。 我的下一个想法是让用户修改他们的PHP代码来使用PHP header函数 ,以便他们可以将其设置为X,我可以使用setifempty应用这只有当用户没有。 经过一番尝试,我发现这些条目工作: Header set X-Frame-Options: "sameorigin" env=!SCRIPT_NAME Header always setifempty X-Frame-Options: "sameorigin" env=SCRIPT_NAME 没有envtesting,我发现第一个命令(即使是setifempty或merge )会添加一个头文件,以便在头文件中看到两个X-Frame-Options 。 那么,这是正确的方式呢? 如果env=SCRIPT_NAMEtesting足够了,还是有更好的testing来确定请求是否将由PHP-FPM / FastCGI或Apache本身处理?
现在我有nginx使用3个服务:1. my.example.com/~ignacio上的我的网页,my.example.com/rstudio上的Rstudio服务器,以及my.example.com/shiny上的Shiny服务器。 这是我的configuration文件现在: # Redirect all traffic from port 80 to SSL port server { listen 80; return 301 https://$host$request_uri; } # Set reverse proxy to port 443 server { listen 443 ssl; server_name my.example.com; ssl_certificate /etc/letsencrypt/live/my.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/my.example.com/privkey.pem; ssl_protocols TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY13$ ssl_prefer_server_ciphers on; index index.php index.html index.htm; # PHP in home directory location […]
我已经在我的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 – […]
经过数小时的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; […]
新的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文件或者哪些文件可以覆盖这个文件?