我的configuration: location /route/ { root /usr/share/nginx/html; location ~ \.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } location / { try_files $uri $uri/ /index.php?$args; rewrite ^/(\w+)$ /?system=$1 break; rewrite ^/(\w+)/(\w+)(/.)*$ /?system=$1&id=$2 break; rewrite ^/(.*)/$ /$1 permanent; location ~ \.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; […]
我试图重写到一个PHP文件在Nginx中没有改变的URL,但PHP-FPM没有处理文件,我得到的是一个500。 如果我删除重写并直接访问文件,它的工作原理,所以.php文件没有错。 server { listen 80; root /var/www/example.com/public_html; server_name example.com www.example.com; index index.html index.php; add_header Access-Control-Allow-Origin *; location ~ ^/InfoCenter/api/.*$ { rewrite "/InfoCenter/api/(.*)" /InfoCenter/api/index.php last; } location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php/php7.0-fpm.sock; include fastcgi_params; } location ~/\.htaccess { deny all; } }
我有一个VCP在林德有“2个CPU核心”和4096MB的RAM。 我的设置是Centos 7与Nginx的谷歌PageSpeed模块,PHP7.1通过PHP-FPM和一个WordPress网站(是的,我知道,WP消耗大量的资源)需要600毫秒来加载整个页面。 真正困扰我的是,在“等待”状态下花费了一半时间。 生成响应需要365ms,并将其发送到浏览器。 这是我从Pingdom工具获得的。 这仅适用于html页面。 总共(脚本,图像,CSS) 在1.35秒总计258KB 。 WordPress的安装是非常基本的:启用一个插件的多站点configuration,这一切。 你会如何减less像WordPress这样的软件的加载时间(我也做过laravel项目)? 任何build议将有所帮助。 提前致谢。
我有一个问题,我的nginx服务器。 安装: – Ubuntu 16.04.02 – Nginx 1.10.3 通过以下configuration我有以下结果: – ubuntulocal / =>工程 – ubuntulocal / mail =>工作 – ubuntulocal / dir2 =>返回php源代码 我现在试了很多,但没有find原因… server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name ubuntulocal; set $root_path /var/www/html; root $root_path; index index.php; fastcgi_read_timeout 600; […]
我的Drupal 8网站托pipe在Apache 2.4 + PHP-FPM上(请参阅下面的configuration)。 Drupal自己pipe理404错误(一切都redirect到/index.php?q=),但是我想返回一个自定义页面,当一个严重的错误发生在PHP代码(错误500)。 由于它是一个PHP-FPM,如果没有“ProxyErrorOverride On”,“ErrorDocument 500”就无法正常工作,如果没有它,那么从“”proxy:fcgi“到Apache的所有内容都可以正常转发给用户。 但是,如果我启用ProxyErrorOverride ,所有的错误现在被Apache 抓住 ,我不能使用Drupal 404,我留下了静态的“ErrorDocument 404”。 有没有办法只设置一个自定义的500页面,而不要触及其余的apache行为? <FilesMatch \.php$> SetHandler "proxy:fcgi://127.0.0.1:58243" # Catch backend errors ProxyErrorOverride On # Return a custom error ErrorDocument 500 "==== 500 =====" # I want this one to be ignored and be process by PHP-FPM #ErrorDocument 404 /404.html </FilesMatch>
所以我正在寻找我使用PHP-FPM在Apache 2.4服务器上持续超时的原因。 这是错误: [proxy_fcgi:error] [pid ###] (70007)The timeout specified has expired:[client XXXXXXXX] AH01075 : Error dispatching request to:, referer: http://address 在下面的configuration文件中,我已经玩过每一个我显示的超时。 我在fpm有两个池: [www] ;user and group info and listening ip and such up here access_log = /path/to/access.log request_terminate_timeout = 15 php_admin_value[error_log] = /path/to/error.log php_admin_flag[log_errors] = on 第二个: [app] ;user and group info and listening ip […]
我一直在研究和调整realpath_cache_size和realpath_cache_ttl ,但是我不清楚如果我把realpath_cache_ttl设置得太高会带来什么后果。 该文档声明如下: 为其caching给定文件或目录的实时path信息的持续时间(以秒为单位)。 对于很less更改文件的系统,请考虑增加值。 好的,太好了。 我可以增加多less? 如果我增加太多会发生什么? 我能增加太多吗? 另外,如果有问题,我正在使用PHP 7 FPM,但我想了解realpath_cache_ttl大值是否也会影响非FPM安装。
我试图设置我的网站与fastcgi_cache运行,发现它有点问题,它不真正刷新内容时,一些新的东西添加到我的网站/网上商店。 所以我偶然发现了插件nginx_helper,这似乎是我需要的一切 – 但它需要安装fastcgi_purge_cache模块。 我现在已经尝试了几次刷新AWS服务器(显然nginx和东西安装),但我似乎无法得到它的工作。 build立: * AWS服务器 * Nginx / php-fpm / php 7 * WordPress的 * CentOS 7 我对服务器的东西很陌生,我尝试了几个不同的指南 – 但最终似乎没有任何的锻炼。 我试图安装https://github.com/FRiCKLE/ ,但我不太清楚如何正确地做到这一点
这是我第三次尝试发布这个问题后,不正确张贴到超级用户和堆栈溢出。 希望这是现在正确的地方! 我接pipe了公司的networking托pipe服务,这是一个运行亚马逊自己版本的Linux和Nginx的AWS服务器。 我对Nginx没有多less经验,但是我需要创build一个运行网站开发版本的子域。 已经有一个现有的“分段”虚拟主机,但它连接到主站点数据库没有用处。 我已经从/etc/nginx/conf.d/staging.conf中将staging conf文件复制到/etc/nginx/conf.d/dev.conf,并将文件中的所有“staging”实例更改为“dev”。 这是这个文件的样子: upstream php-dev-backend { server unix:/tmp/php-fpm-dev.sock weight=1; } server { server_name dev.groundlevel.co.uk; listen 80; root /var/www/vhosts/dev.groundlevel.co.uk/web-root; index index.html index.htm index.php; access_log /var/log/nginx/dev.groundlevel.co.uk_access_log; error_log /var/log/nginx/dev.groundlevel.co.uk_error_log; location @handler { rewrite / /index.php; } location / { index index.php index.html; try_files $uri $uri/ @handler; expires 30d; } include magento_security; include fastcgi_params; […]
我正在build立一个WordPress的子域的过程中。 我得到了一个404错误,我的nginxconfiguration。 目前使用PHP版本:7.0.22,没有得到任何错误的PHP日志,但我在nginx /var/log/nginx/error.log *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: xxx.xxx.xxx.xxx, server: kb.workspire.io, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php7-fpm.sock", host: "kb.workspire.io" 这是我目前的服务器块 /etc/nginx/sites-available/kb.workspire.io server { listen 80 server_name kb.workspire.io; root /var/www/kb.workspire.io/wordpress; index index.php; location / { #try_files $uri $uri/ =404; try_files $uri $uri/ /index.php?q=$uri&$args; } listen 443 ssl; error_page 404 […]