我正在运行ArchLinux和nginx,并且不能在实际的PID文件中不使用kill -9情况下停止nginx。 我宁愿使用/etc/rc.d/nginx stop ,让nginx脚本在.pid文件中查找nginx,但文件不在那里。 我touch它,但也没有帮助。 我们欢迎所有的build议! 非常感谢。 编辑: 这是我看到,当我input/etc/rc.d/nginx restart 所以这里出了点问题
我已经使用nginx(0.7.65-2〜bpo50 + 1),PHP 5.2.9在fast-cgiconfiguration中工作,但是我发现我们忙碌的网站在高负载时挂起。 通过杀死和重新启动php进程,问题立即解除。 我有8个PHP工作进程,和2个nginx工作者。 我知道这在这个configuration中是相当普遍的问题,但是还没有能够确定一个优雅的解决scheme。 有没有人有任何build议? 任何帮助非常感谢! 🙂
我使用Gentoo上的nginx web服务器通过FastCGI运行PHP。 PHP是由lighttpd的spawn-fcgi脚本启动的,它使用start-stop-daemon作为守护进程运行。 除此之外,启动脚本清理环境,以便在PHP启动时只保留PATH,PHP_FCGI_CHILDREN和PHP_FCGI_MAX_REQUESTS。 但是,在我的机器上,除了这些variables,在_SERVER我也看到USER和HOMEvariables。 不仅他们在那里,而且他们也分别被设置为“root”和“/ root”,这是错误的,因为PHP以用户“nobody”运行(使用echo exec('whoami')确认)。 我的安装有什么问题? 我怎样才能摆脱那些不应该在那里的变数?
我想让我的Nginx负载均衡器在一个头上发送一个时间戳到上游服务器上。 我尝试了这样的事情: proxy_set_header X-Start-Time $msec; 当然,$ msec是一个日志variables,Nginx会给出一个错误: Restarting nginx: [emerg]: unknown "msec" variable
嗨,我习惯于与Apache和Mod代理,我的服务器configuration看起来有点像这样,我redirect所有传入的请求 ServerName example.com DocumentRoot / var / www / trunk / public ServerName www.example.com redirect永久/ http://mentoredge.com ProxyPreserveHost打开 ServerName o.example.com ProxyPass / http:// localhost:8000 / ProxyPassReverse / http:// localhost:8000 / 在这里,我将所有的input请求路由到本地主机的8000端口。 我已经迁移到Nginx现在即时尝试设置相同的o.example.com这个代理。 有人可以向我解释如何做到这一点。 server { listen 80; server_name o.example.com; location / { proxy_pass http://localhost:8000; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size […]
Apache的模块mod_env提供了一个在configuration文件中设置环境variables的简便方法,例如: <VirtualHost *:80> ServerName xyz.com DocumentRoot /var/www/rails_app/public PassengerAppRoot /var/www/rails_app SetEnv MY_VARIABLE contents </VirtualHost> http://httpd.apache.org/docs/2.0/mod/mod_env.html#setenv 但是,在nginx中我找不到任何符合相同目的的东西。 这里有什么select? 我想在.profile文件(我使用的是Ubuntu 10.04)中设置环境variables,但这不会有我与Apache的“每vHost”隔离相同,对吧? 这里有什么select?
请帮我写下nginx重写,而不是Apache htaccess: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)([^/])$ $1$2/ [R,L] RewriteCond %{ENV:REDIRECT_RDR} ^$ RewriteCond %{HTTP_HOST} ^(.+)\.site\.com$ #RewriteCond %2 !www RewriteCond %{HTTP_HOST} !^www\.site\.com$ RewriteRule ^([a-zA-Z0-9`~!@#$%^&()\-+";=\\/|]*)$ blogs/fake/%2/$1 [L,E=RDR:1] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !/urlrewriteprepend.php$ RewriteRule ^(.*)$ /urlrewriteprepend.php [L]
我在运行Debian Lenny x86_64的服务器上使用了一堆nginx + php-fpm。 有时PHP-FPM的进程会以100%的速度加载全部8个内核,并且直到强制重新启动PHP-FPM,这个负载才会下降。 我怎样才能确定这样的跳跃负载的问题是什么? 在PHP-FPM的日志中没有什么不寻常的。 PHP版本 – 5.3.3。
我有一群web服务器运行在Apache-PHP(与prefork)。 我打算从prefork转到worker(fcgi)。 问题是,我不能一次移动所有的服务器,所以在短时间内(天的问题)他们几个将在fcgi和一些modphp。 我今天testing了会话是否在这两种服务器之间工作(一个testing服务器与fcgi和一个真正的mod_php),看起来不是,当我的代理(基本nginx)redirect我从一个ws与fcgi到一个与mod_php。 托pipe在这些服务器上的应用程序是一个只有很less修改的核心(核心上没有任何东西)。 如果我把代理拿出来,一切正常,我可以从一个节点改变到另一个,而且会话是一样的。 有什么可以导致这个nginx? 以下是nginxconfiguration的一部分: proxy_ignore_headers "Cache-Control" "Expires"; proxy_cache_valid 200 302 60m; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_max_temp_file_size 0; client_max_body_size 100m; client_body_buffer_size 128k; proxy_connect_timeout 600000; proxy_send_timeout 600000; proxy_read_timeout 600000; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 […]
我想知道,如果我可以有条件地提供一个特定的文件作为404页面基于请求的URL,或内容types/ MIMEtypes请求。 我猜测的是: if url_extention == (gif|jpg|png): /404.gif else: /404.html 我不太熟悉NGINX 404 / url重写。 目前,我有: server { listen 80; server_name static.example.com; access_log off; location / { root /warehouse/web/static/static.example.com; expires 3d; error_page 404 = /404.gif; } location /404.gif { root /warehouse/web/static/404; } }