在Ubuntu 11上,Nginx根据path正确地为CouchDB或Node.js服务,但是无法让Nginx通过它的端口访问Rails应用程序。 server { rewrite ^/api(.*)$ $1 last; listen 80; server_name example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:3005/; } location /ruby { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:9051/; } location /_utils { proxy_pass http://127.0.0.1:5984; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; […]
尽pipe我已经花了两天的时间在论坛上阅读,但我仍然无法在Nginx中重写一些Codeigniter重写。 这是服务器configuration: server { listen *:80; server_name artademy.com www.artademy.com; root /var/www/artademy.com/web; index index.html index.htm index.php index.cgi index.pl index.xhtml; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1; } if (!-e $request_filename) { rewrite ^/(index.php\?)/(.*)$ /$1/mobile_app last; break; } error_log /var/log/ispconfig/httpd/artademy.com/error.log; access_log /var/log/ispconfig/httpd/artademy.com/access.log combined; ## Disable .htaccess and other hidden files location ~ /\. { deny all; access_log […]
在我的nginxconfiguration中,我有以下几点: location /admin/ { alias /usr/share/php/wtlib_4/apps/admin/; location ~* .*\.php$ { try_files $uri $uri/ @php_admin; } location ~* \.(js|css|png|jpg|jpeg|gif|ico|pdf|zip|rar|air)$ { expires 7d; access_log off; } } location ~ ^/admin/modules/([^/]+)(.*\.(html|js|json|css|png|jpg|jpeg|gif|ico|pdf|zip|rar|air))$ { alias /usr/share/php/wtlib_4/modules/$1/admin/$2; } location ~ ^/admin/modules/([^/]+)(.*)$ { try_files $uri @php_admin_modules; } location @php_admin { if ($fastcgi_script_name ~ /admin(/.*\.php)$) { set $valid_fastcgi_script_name $1; } fastcgi_pass $byr_pass; fastcgi_index […]
我的朋友有一个网站,允许用户下载files.However然后一个人开始下载服务器负载从0.00分钟到3.50在几分钟内.Nginx和php-fpm达到D状态和IOwait是所有的CPU核心100%我试图限制并发连接的数量,但这似乎对服务器负载没有影响。 user nginx; worker_processes 4; events { worker_connections 1024; } sendfile on; #tcp_nopush on; gzip on; #keepalive_timeout 0; keepalive_timeout 2; 我的php-fpm设置 pm.max_children = 7 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 6 pm.max_requests = 500 服务器 – 8GB内存四核处理器1TB SATA硬盘
没有磁盘io去iotop的结果 Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s TID PRIO USER DISK READ DISK WRITE SWAPIN IO< COMMAND 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init [3] 1930 be/4 named 0.00 B/s 0.00 B/s 0.00 % 0.00 % named -u ~d/run-root 1931 be/4 named 0.00 B/s 0.00 […]
Ubuntu 11.04,node.js 0.6.16,nginx 1.0.8 我开始debugging下面的错误,我们从很重的负载(3500用户积极长时间轮询/使api调用)频繁地从前端logging: parsererror:Error: jQuery171045845469435053_1347386706235 was not called", 所有产生这个错误的调用都是通过一个nginx代理到一个node.js服务器的长时间轮询。 发生这种情况时,我发现在服务器的以下位置出现以下错误: 在/var/log/syslog我每隔几分钟就会看到一次这样的爆发: [6356088.813219] TCP: Possible SYN flooding on port 8894. Sending cookies. 在nginx error.log ,我看到以下两个错误更频繁的突发: 2012/09/11 18:13:05 [error] 25104#0: *1229679431 upstream timed out (110: Connection timed out) while connecting to upstream, 和 2012/09/11 18:10:38 [error] 25103#0: *1229382210 recv() failed (104: Connection reset by peer) […]
最近我有一个项目,我正在由一位朋友提供资金。 所以他给了我一个60Mbps的专用连接线和HP Compaq 8200 Elite。 惠普只是一个桌面,但我使用它作为服务器,因为…我现在买不起一个新的VPS,它有一些很好的规格。 它有: Intel(R)Core(TM)i5-2500 CPU @ 3.30GHz; 4GB内存DDR3; 500GB高清7200RPM。 就像我说的,桌面,但有一些很好的规格。 所以我安装了Nginx,PHP-FPM,Percona的MySQL和APC,运行WordPress,这个平台我将用于这个项目。 Nginxconfiguration为使用微caching,因为我发现它比Varnish更快。 来自nginx的caching使用tmpfs进入RAM。 我还使用WP-FFPC作为“高级caching”,用于CDN的W3总caching,缩小和数据库caching。 APC对象高速caching后端用于对象高速caching,FX Gravatar用于gravatar高速caching,全部挂载到RAM。 所以这似乎是一个很好的设置在我的头上,但是当我开始做负载testing,似乎不是很好。 在Blitz.io上,我每次testing都会得到10〜20个超时,并且说我每天可以获得9,699,500次点击。 相当不错,但问题是:在低端VPS我运行,与512MB和1.2GHz的1核心CPU,我得到相同的结果,但没有超时。 唯一不同的是VPS需要大约250ms来显示内容,而服务器只需要60ms,但我认为这是因为延迟。 无论如何…我的整点在这里是:为什么速度似乎更好,Blitz.io显示这台服务器可以处理相同的我的VPS手柄,即使这台服务器是3倍,更快? 通过Apache abtesting,我也只有15 req /秒…这似乎真的很低,因为我看到一些人得到一些疯狂的数字,即使与WordPress。 我不知道是否所有这一切是因为我的服务器是一个桌面,也许I / O相关? 还是networking? 你们可以看看我的设置,看看他们是否正确,或者这是我所有的设置的错误,请? Nginxconfiguration文件 nginx.conf: http : //paste.ubuntu.com/1203836/ fastcgi_params: http : //paste.ubuntu.com/1203837/ / sites-avaiable / default: http : //paste.ubuntu.com/1203839/ PHP-FPMconfiguration文件 /pool.d/www.conf:http://paste.ubuntu.com/1203842/ apc.so:http://paste.ubuntu.com/1203843/ MySQLconfiguration文件 my.cnf: […]
我的问题很简单。 我今天早上在主页上做了一些修改(添加了一些句子),并没有出现在我的浏览器中。 我清除symfonycaching,nginxcaching,APCcaching,重新启动Apache,重新启动Nginx和…什么都没有。 然后我尝试从我的智能手机上访问它。 依然没有。 但是我的同事尝试了,而且工作。 (我们有两个不同的ISP) 所以我build议这是ISPcaching问题。 因为我试图从生产服务器上运行它,它工作。 然后我尝试了一些其他的东西:我通过www.mydomain.com访问了我的主页,但是我用Apache IP地址而不是Nginx IP地址修改了标题,并且工作正常。 所以看起来这是一个Nginx的ISP问题,但我不知道有什么问题… 任何帮助将非常感激! 这是我的NGINXconfiguration文件: server { listen 80; ## listen for ipv4 server_name www.mydomain.com; access_log /var/log/nginx/nginx1.access.log; error_log /var/log/nginx/nginx1.error.log; location / { proxy_pass http://apache; } location ~* ^.+.(swf|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|woff)$ { proxy_cache_valid 2d; proxy_pass http://apache; proxy_cache staticfilescache; } )
即时通讯与nginxconfiguration相对简单的重写规则/路由器有困难。 我想要做的是,如果请求目录或文件'主机/我/请求/path[/ [index.php]]'不存在,重写为'主机/我/请求/ path.php' 目前的重写工作如下: host host/ host/my/request/path 但不会为: host/my/request/path/ 这是configuration的重写部分: location / { try_files $uri/ $uri $uri.php; } 错误日志将报告: Access forbidden by rule, request: "GET /my/request/path/ HTTP/1.0" 嗯,有没有更好的方法来解决这个问题或摆脱尾随斜线? 编辑,规则更精细: host[/] > host/index.php host/index[/] > host/index.php host/my/path[/] > if /path/index.php exists: host/my/path/index.php else host/my/path.php
我希望我的服务器代理Google如果我的$request_body的POSTed请求包含stringgoogle ,例如 echo "google" | lwp-request -m POST "http://127.0.0.1" 所以我有这样的configuration,例如 server { listen 127.0.0.1:80 default; location / { if ($request_body ~* .*google.*) { proxy_pass http://www.google.com; break; } } } 但是上面configuration的结果总是“404 Not Found” 任何想法? 谢谢。