这是基于官方Symfony2文档的网站configuration server { listen 80; server_name project.local; root /media/Storage/project/web; location / { # try to serve file directly, fallback to app.php try_files $uri /app.php$is_args$args; } location ~ ^/(app|app_dev|config)\.php(/|$) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; } error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; } server { listen 443; server_name project.local; root /media/Storage/project/web; […]
对不起,相当混乱的标题,我想了解这个错误。 我有一个php文件,在site.com/src/app/index.php这样的文件夹中,这个site.com文件夹放在/var/www/html/中,运行在CentOs 6.5中,运行Nginx和PHP-FPM。 所以,问题是,每当我使用任何path函数和常量像__DIR__ , getcwd() , index.php里面的realpath() ,我期望完整的path是 /var/www/html/site.com/src/app/但只有site.com/src/app/被返回。 这就好像那个php / nginx不知道var/www/html/文件夹。 我的事件去了app/目录,并能够使用sudo pwd得到完整的path,但由于某种原因,PHP不读它。 我想知道为什么会发生这种情况,以及如何解决这个问题?
所以对于nginx来说是新的。 在Ubuntu上,我使用“sudo apt-get install nginx”安装了nginx,然后安装了php5-fpm sudo apt get install php5-fpm 。 我遵循以下步骤: https : //www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04,并得到了nginx工作罚款与php5-fpm 。 这是从我的nginxconfiguration文件启用fastCGI代理的相关部分。 location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } 这工作完美,PHP文件运行如何,他们假设。 然后我下载了nginx-1.7.3.tar.gz,如果从源代码build立: –configure –prefix=/usr/local/nginx-1.7.3 make sudo make install 所以现在我会有两个安装nginx。 第一个使用apt-get install nginx ,这个是从源码build立的。 我可以以不同的方式运行每一个sudo service nginx start运行apt-get install version , sudo /usr/local/nginx-1.7.3/sbin/nginx运行从源代码构build的版本。 要启用“从源代码构build”的fastCGI代理,我认为它与第一次安装nginx相同,因此nginx.conf文件的快速cgi代理位置块与第一个相同。 但 […]
我们正在面对一个产生太多孩子的php-fpm服务器的问题。 今天早上,我设置了php-fpm的状态页面 ,并且获得了一个有趣的信息:在由孩子执行的所有脚本中,有一个请求持续时间大约等于3050111212255天,等于3050111212255微秒,这是机器的正常运行时间,尽pipe我们最近重新启动了php-fpm 。 这里是这个脚本的状态页面的输出。 pid: 19998 state: Idle start time: 29/Aug/2014:14:48:25 +0200 start since: 578 requests: 244 request duration: 3050444744915 request method: POST request URI: /app.php?_format=json content length: 96 user: jobuser script: /home/frontoffice/instances/encoding/current/web/app.php last request cpu: 0.00 last request memory: 7864320 你认为这是一个在PHP的FMP的错误?
server { listen 80; server_name example.com; root /srv/www/example.com; access_log /srv/www/example.com/logs/access.log; error_log /srv/www/example.com/logs/error.log; location / { index index.html index.php; } location /site1 { try_files $uri $uri/ /index.php; index index.php index.html; root /srv/www/example.com; } #Pass the PHP scripts to FastCGI server location ~ /site1/.+\.php$ { set $php_root /srv/www/example.com; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name; include fastcgi_params; […]
我正在经历高CPU使用率,这是我从服务器获得的统计数据,在15分钟内每次重新启动后的消耗达到100%,会出现什么问题? 我有一个网站laravel安装在服务器上没有太多的stream量(+ – 500用户),这里是我从服务器中使用顶级命令得到的统计数据。 top – 19:23:15 up 1 day, 10:55, 1 user, load average: 207.49, 204.19, 190.39 Tasks: 1303 total, 143 running, 1144 sleeping, 16 stopped, 0 zombie Cpu(s): 81.4%us, 7.2%sy, 0.0%ni, 8.4%id, 0.0%wa, 0.0%hi, 0.4%si, 2.6%st Mem: 33012284k total, 23683980k used, 9328304k free, 399100k buffers Swap: 0k total, 0k used, 0k free, 5473208k […]
我有一个运行在我的VPS上的WordPress站点,这个站点是相当高规格的(3520MB RAM,4个内核)。 服务器运行Nginx和php5-fpm。 虽然该网站在前端有响应,但后端往往会很慢,一些pipe理页面需要几秒钟才能加载。 该网站运行WooCommerce,但我有WP总caching运行以及APC对象caching。 我的问题是真的关于php5-php的configuration,因为我想我可能没有设置最佳利用服务器的资源。 这是我在php5池中的www.conf : pm.max_children = 10 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers – min_spare_servers) / 2 pm.start_servers = 2 ; The desired minimum number of idle server processes. ; Note: Used […]
我有以下重写nginx的规则。 规则似乎无法正常工作,例如游戏规则应该将http://thegamesdb.net/game/2/重写为http://thegamesdb.net/index.php?tab=game?id=2当我导航到/游戏/ 2 /浏览器正在下载一个名为简单download的文件hover。 我的重写规则如下: # nginx configuration location /game { rewrite ^/game/([0-9]+)(/?)$ /index.php?tab=game&id=$1 break; rewrite ^/game-edit/([0-9]+)(/?)$ /index.php?tab=game-edit&id=$1 break; } location /search { rewrite ^/search/([a-z0-9\-\ /\+]+)(/?)$ index.php?tab=listseries&string=$1&function=Search break; rewrite ^/search(/?)$ /index.php?tab=listseries&function=Search break; } location /browse { rewrite ^/browse/([0-9+]*)(/?)$ /index.php?tab=listplatform&stringPlatform=$1&function=Browse+By+Platform break; } location /platform { rewrite ^/platform/([0-9]+)(/?)$ /index.php?tab=platform&id=$1 break; rewrite ^/platform/([a-z0-9\-]+)(/?)$ /index.php?tab=platform&alias=$1 break; rewrite ^/platform-edit/([0-9]+)(/?)$ /index.php?tab=platform-edit&id=$1 […]
PHP-FPM 5.6和Nginx 1.6.2毫无疑问会提供最大的性能,至less在速度上是明智的。 所以,我想知道是否有任何优点/缺点添加清漆caching,以获得可能几乎没有更多的速度。 我读过很多博客,说nginx + varnish单独是有点矫枉过正,但我还没有得到一个反馈,可以certificate这一点。
我有一个Nginx和PHP5-FPM的Ubuntu服务器,其中的设置如下: /etc/php5/fpm/pool.d/www.conf pm = dynamic pm.max_children = 6 pm.start_servers = 4 pm.min_spare_servers = 2 pm.max_spare_servers = 6 ;pm.process_idle_timeout = 10s; pm.max_requests = 200 /etc/php5/fpm/php-fpm.conf emergency_restart_threshold = 5 emergency_restart_interval = 1m process_control_timeout = 10 在此服务器中,有4个站点和一个应用程序正在运行,此应用程序以用于发送连续状态更新和确认的方式工作。 问题是,当应用程序没有得到确认,应用程序不断进入无限的等待状态,所有的php进程都被这个应用程序使用,而所有其他的网站都停止运行。 然后我们需要重新启动php5-fpm进程来解决这个问题。 然后几分钟后,所有的过程被这个应用程序使用。 所以,请让我们知道有什么select来解决这个问题? 也有任何选项分配只有3个PHP进程到这个应用程序,所以只有这些分配过程进入无限循环,其他3个进程可以pipe理网站,使网站不会倒下。 任何人都可以请指导我们?