Articles of nginx

用作代理时的nginx连接跟踪/活动

使用Nginx作为另一个HTTP应用程序服务器的代理。 有没有办法知道每10分钟有多less连接从ngnix到后端,也从前端到ngnix? 谢谢

为什么这个nginx /瘦运行木偶大师解释path不同于一个单独的puppetmaster?

为了这个问题的目的,我需要区分我的制作木偶大师和我的发展木偶大师。 无论哪种情况,我的/etc/puppet/puppet.conf是: [main] ssldir=$vardir/ssl [master] certname=puppet 开发木偶大师正在运行: # puppetmasterd –debug –no-daemonize 生产木偶大师是一个瘦/ nginx的事情。 相关的nginxconfiguration文件: # /etc/nginx/sites-enabled/default upstream puppet-production { server unix:/var/run/puppet/master.00.sock; server unix:/var/run/puppet/master.01.sock; server unix:/var/run/puppet/master.02.sock; } server { listen puppet:8140; include conf.d/puppet_ssl.conf; include conf.d/puppet_proxy_set_header.conf; default_type application/x-raw; location /production/file_content/ { rewrite ^/production/file_content/([^/]+)/(.*) /$1/files/$2; break; root /etc/puppet/modules/; } location / { proxy_pass http://puppet-production; } } 和 # […]

我可以在已经在Apache上的服务器上安装Ngnix吗?

我有一个运行在Apache上的专用服务器,我听说Nginx使用更less的资源,并在相同的硬件上提供了10倍的更好的结果。 我可以用NginxreplaceApache吗? 它会影响我的服务器的任何数据或设置?

nginx不会写入varnish后面的caching

我有nginx作为远程Web服务器的反向代理。 caching写入文件。 但是,当我将Varnish放在它的前面时,nginx会停止写入caching文件,这会导致性能下降,并使stream量翻倍。 前端(Varnish)如何告诉nginx不要caching这些请求? 我试图debugging,但没有发现任何东西。 我的nginxconfiguration是这样的: server { … location / { … proxy_ignore_headers Set-Cookie Expires Cache-Control; proxy_cache p-cache; } } 再次,如果我直接请求nginx,没有问题。 但是我必须使用Varnish,这是对该服务器的其他服务的唯一门。

设置多个Web应用程序,使用一个IP来响应多个域

我有两个rails webapps,我已经configuration了一个webapp来响应多个域。 我通过将nginx中相应的服务器块设置为默认值来完成此操作。 现在,我甚至想要为其他webapp进程请求定制多个域, 有没有办法使用单个IP地址的机器来做到这一点? (我知道我可以添加一个额外的IP地址,并让其他webapp监听,但我的服务器是在EC2上,所以我不能添加更多的IP地址。) 这两个webapps都知道他们应该回应哪个域名,并且有很多域名。 而且,这些web应用程序需要响应的域将会改变。 所以我不能在nginxconfiguration中对它们进行硬编码。 我的服务器有Ubuntu 10.04。 我已经研究了一下,我认为HAProxy可以做这种路由。 HAProxy ACL可以访问类似redis的东西来查找http请求的目的地吗?

根据url限制文件大小上传

我有一个网站build立与玩! 我使用ssl与NGinx一起展示的框架 。 一切工作正常,但我想实现基于URL的file upload限制: 如果用户上传文件到* / pages / **( / pages /或/ page / {id} / edit ),我将限制到10Mo (这将是zip压缩文件) 如果用户上传一个文件到* / images / **( / images /或/ images / {id} / edit ),我会将大小限制为2Mo (只会是图片) 这里是我卡住的地方: 我看到了client_max_body_size指令,这正是我想要的,但是我必须为每个位置指定proxy_ *configuration吗? 如果用户在我的应用程序(位于/ errors / 413)中达到允许的配额,我将显示一条特定消息。 如果我直接使用我的浏览器,它的工作。 但是使用下面的configuration,我有一个“ 504网关超时 ”。 为什么? 这是我的configuration文件: server { listen 443; server_name www.mywebsite.com; access_log […]

如何用Nginx远程login

有没有人对Nginx的远程访问和错误日​​志有经验? 我们有这样的Apache设置,但是想迁移到Nginx。

nginx – 如何获得服务器inheritance/添加caching头到各种反向代理网站

我有大约5个站点通过反向代理在不同的端口上运行,并可以在不同的子域下访问。 其中一些网站自行设置过期时间(/ cache-control max age header),不需要pipe理,但有些则不需要。 对于那些我没有,我想指定过期的静态内容(按照https://github.com/h5bp/server-configs/blob/master/nginx.conf ),但我找不到办法这没有在每个服务器上重复这个逻辑。 对于一台服务器我知道我可以这样做: server { listen 80; server_name sub.domain.com; location \ { proxy_pass http://localhost:1234/; } # cache.appcache, your document html and data location ~* \.(?:manifest|appcache|html|xml|json)$ { proxy_pass http://localhost:1234/; expires -1; access_log logs/static.log; } # Feed location ~* \.(?:rss|atom)$ { proxy_pass http://localhost:1234/; expires 1h; add_header Cache-Control "public"; } # Favicon […]

nginx将一堆子域重写为域

我configuration了我的第一个nginx服务器,我必须redirectsubdomain1.domain.com,subdomain2.domain.com和一些更多的domain.com 我在nginx中search了很多关于重写的内容,但找不到任何有用的东西。 谢谢!

多个独angular兽/ Rails应用程序,Nginx,一个用户

我使用以下独angular兽configuration成功部署了一个使用Capistrano,Unicorn,Nginx的Rails应用程序: env = ENV [“RAILS_ENV”] || “发展” worker_processes 4 听“/tmp/app_one.socket”,:backlog => 64 preload_app true 超时60 pid“/tmp/unicorn.app_one.pid” 如果env ==“生产” working_directory“/ home / single_user / app_one / current” 用户'single_user' shared_pa​​th =“/ home / single_user / app_one / shared” stderr_path“#{shared_pa​​th} /log/unicorn.stderr.log” stdout_path“#{shared_pa​​th} /log/unicorn.stdout.log” 结束 before_fork do | server,worker | 如果定义?(ActiveRecord :: Base) ActiveRecord的:: Base.connection.disconnect! 结束 old_pid =“/tmp/unicorn.app_one.pid.oldbin” 如果File.exists?(old_pid)&& […]