Articles of nginx

每秒观察到否定请求?

我目前正在看我的Nagios指标,特别是在我的Web服务器上,我突然注意到,有时,我有一个负面的每秒请求数和其他指标,怎么可能? 我虽然每秒请求或每秒连接只能是正值或等于零。 那里发生了什么? 那么负值是否意味着Web服务器通过Keepalive或使用caching数据来重用现有连接? 如果有人能够解释我的这些指标,那就太好了。

在HTTPS下这是多less(40x)nginx放缓预计?

所以我创build了一个简单的文件,ab.htm,里面只有“test”。 ab -n 1000 -c 10 http://www.domain.com/ab.htm 给我15400req /秒 和 ab -n 1000 -c 10 https://www.domain.com/ab.htm 给我390req /秒 如果我加上-k Keep-Alive标志,它会回到〜10,000。 但是,这不是一个解决scheme,如果我得到1000个并发用户,他们不会共享相同的连接… 这是一个4GB的Centos 6 VPS,nginx 1.5.6。 我也尝试过1,100和1000的并发,得到了类似的结果。 我期待它慢一些,但不是太慢一点….这是正常的,还是有一些可怕的错误? 如果这是正常的,我可以做些什么来改善这种情况 – 我认为更弱的密码等等? 是的,我明白这只是这个难题的一小部分,与脚本和数据库加载相比,这是相当微不足道的。 但是,至less我想知道这是正常的。 谢谢 附加信息: CentOS 6.4 英特尔E5-2640 CPU Xen VPS(我认为在HP DL380p Gen8 Proliant服务器上) 4GB内存 版本等: uname -a Linux 2.6.32-358.18.1.el6.x86_64#1 SMP Wed Aug 28 17:19:38 UTC […]

nginx + PHP的PHP – > 404 PHP页面 – 文件未find

*2037 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 server_name .site.com; root /var/www/site; error_page 404 /404.php; access_log /var/log/nginx/site.access.log; index index.html index.php; if ($http_host != "www.site.com") { rewrite ^ […]

nginx的+ PHP-FPM(chroot环境)。 没有指定input文件

OS:Centos PHP:5.5.6 Nginx:1.4.4 Nginx conf server { listen 80; server_name example.ltd; root /srv/example.ltd/www; index index.php; access_log /srv/example.ltd/logs/nginx-main.log main; error_log /srv/example.ltd/logs/nginx-error.log warn; autoindex on; location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { fastcgi_pass unix:/srv/example.ltd/tmp/example.ltd.sock; fastcgi_index index.php; fastcgi_param SCRIPT_NAME /www$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SERVER_NAME $host; fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name; include fastcgi_params; } } […]

Nginx:logging完整的请求数据?

简单地说,是否可以让nginxlogging所有的请求信息(源地址,协议,头文件等)? 特别是在一些可parsing的格式。

Nginx欢迎页面返回

我在EC2实例上运行Nginx。 我有一个网页安装在默认的/usr/share/nginx/html目录中。 我注意到,如果我使用AMI创build一个EC2实例的AMI和一个新的EC2实例,默认的Nginx欢迎站点(即index.html,404.html等)被恢复并覆盖我现有的网站这些文件是一样的。 我可以通过在那个目录中做一个git status来看这个,看看他们已经被添加了。 这有点痛苦,因为我在EC2实例上运行一个SaaS产品,让客户看到Nginx的欢迎页面看起来有些不专业。 我的问题是:这可能是什么原因造成的? 这是我的nginx.conf : # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes 1; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main […]

nginx重新安装后无法工作?

我真的不知道从哪里开始寻找答案:我按照这里的指示设置nginx和debian的乘客。 ( sudo apt-get nginx-extras passenger )一切正常。 然后我试着设置ssl: 创build了一个服务器密钥等 复制/ etc / nginx / sites-available / default并取消注释并编辑必要的行 在/ etc / nginx / sites-enable中创build了一个符号链接 重新启动nginx 突然间,我无法通过Firefox连接到服务器了。 所以我解开了上述的每一步 – 什么也没有。 我卸载了nginx-extras和passenger,并手动删除了所有名为'* nginx *'的文件和目录,因为我看到整个/ etc / nginx /目录仍然存在。 然后,我再次安装了一切 – 仍然没有。 即使当我以为这是完全删除ps waux | grep nginx ps waux | grep nginx产生这个: USERNAME 3776 0.0 0.1 11292 928 pts/0 […]

如何获取Nginx非根(“/”)位置来提供文件?

我是Nginx的初学者。 我用Ubuntu 12.04租了一点VPS来testing。 我租了没有域名,所以我直接使用IP请求。 对于这个问题,我们假设IP是209.208.26.89 。 从官方ppa安装最新的稳定的Nginx。 安装Nginx并检查工作正常后(使用浏览器浏览http://209.208.26.89 ),我从/ etc / nginx / sites-enabled中删除了默认configuration。 我首先使用了这个configuration: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /home/www-data/public-www; index index.html index.htm; #index.html is inside /home/www-data/public-www server_name 209.208.26.89; #remember, no domain location /example { root /home/www-data/public-www/example; index hello.html; #hello.html is inside /home/www-data/public-www/example try_files $uri $uri/ =404; } } […]

Nginx和PHP-FPM – 无法打开主脚本错误

我有一个关于查看单个post的重写规则的博客。 查看由名为view.php的文件处理。 我在我的vhostconfiguration中使用了一些重写规则,如下所示: location /view { rewrite ^/view/([^/.]+)?/?(.*) /view1.php?pid=$1&$query_string; } 这使得URL如下所示: http://domain.com/view/xxxx 其中xxxx是postID。 在同一页面上,我有一个社交分享插件,其中包含一个名为share.php的文件,位于与view.php文件相同的目录中。 该插件工作正常,但是我在我的日志中收到以下错误: FastCGI sent in stderr: "Unable to open primary script: /var/www/domain.com/view/xxxx/share.php (No such file or directory)" 我猜测它与我的nginxconfiguration文件中的上述重写规则有关。 我该如何解决这个问题? 我应该在vhostconfiguration文件中为share.php文件添加特定的重写规则吗? 这是我的PHP conf: location ~ \.php$ { root /var/www/domain.com; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_ignore_client_abort on; fastcgi_param SCRIPT_FILENAME […]

用nginx截获404作为memcached + node.js的反向代理

我使用nginx作为反向代理从memcached中查找html内容(如果不存在),那么node.js(如果没有的话),node.js返回404.我想要做的是拦截并提供一个自定义由node.js返回的404页面 问题是,nginx不会返回正确的404.html,而是它的默认值。 所以,虽然我可以截获404页面,但nginx却传递了默认的错误页面,而不是404.html upstream memcached { server 127.0.0.1:11211; } error_page 404 /404.html; location /404.html { internal; } location @memcached { … if ($memcached_request = 1) { memcached_pass memcached; error_page 404 502 504 = @nodejs; } if ($memcached_request = 0) { error_page 404 502 504 = @nodejs; } } location @nodejs { proxy_pass http://127.0.0.1:7777; … error_page […]