unicorn 的示例 nginx.conf 中不允许使用 nginx 指令

标签 nginx unicorn

我正在使用 nginx 1.4.1。复制后unicorn's example of nginx.conf ,我发现设置必须移动到不同的指令。我仍然无法在 nginx.conf 中放置以下设置文件:worker_processes , user , pidevents堵塞。当我按原样放置它们时,日志显示 directive is not allowed here .我应该修复什么?

worker_processes 1;
user deployer sudo; # for systems with a "nogroup"
pid /run/nginx.pid;

events {
  worker_connections 1024; # increase if you have lots of clients
  accept_mutex off; # "on" if nginx worker_processes > 1
}

upstream abc {
  ...
}

server {
  ...
}

更新 1

我知道这个 post ,但奇怪的是我所做的一切都不起作用。我在 nginx 中找不到任何文档。

最佳答案

原来的例子不能直接用,因为主要配置在/etc/nginx/nginx.conf . /etc/nginx/nginx.confhttp指令,包括 sites-enabled/*指令。唯一要在 /etc/nginx/nginx.conf 上进行的更改是:

work_processes 4;
worker_connections 1024;

另外,删除 text/html来自它,因为默认情况下它已经被 gzip 压缩了。

您的 nginx.conf 的最终结果在您的应用中应该没有 http指令,只是 upstreamserver .

关于 unicorn 的示例 nginx.conf 中不允许使用 nginx 指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19281626/

相关文章:

Spring - nginx 中的邮件发件人

nginx - Nginx MIME类型和gzip

ruby-on-rails - Web 服务器和应用服务器

ruby-on-rails - 加速 ruby​​ on rails 网站

ruby-on-rails - Rails 应用程序在使用 Unicorn/nginx 组合的 DigitalOcean 上没有响应

apache - 具有使用自定义 session 端点的连接池的反向代理?

PHP cURL 在本地工作,在 AWS 服务器上出现错误 77

magento - 在 magento 中使用 Varnish 缓存的 nginx 上的自动货币开关不起作用

对 gitlab 6.5 的 HTTPS 请求超时

ruby-on-rails - 好的 unicorn + nginx +帽子部署方法