- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试让 nginx 与 rails 应用程序一起使用,但 nginx 在安装和更改其配置文件后无法启动。
这是它给我的输出:
nginx: [emerg] could not build the types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 32
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx.conf
文件:
# This is example contains the bare mininum to get nginx going with
# Unicorn or Rainbows! servers. Generally these configuration settings
# are applicable to other HTTP application servers (and not just Ruby
# ones), so if you have one working well for proxying another app
# server, feel free to continue using it.
#
# The only setting we feel strongly about is the fail_timeout=0
# directive in the "upstream" block. max_fails=0 also has the same
# effect as fail_timeout=0 for current versions of nginx and may be
# used in its place.
#
# Users are strongly encouraged to refer to nginx documentation for more
# details and search for other example configs.
# you generally only need one nginx worker unless you're serving
# large amounts of static files which require blocking disk reads
worker_processes 1;
# # drop privileges, root is needed on most systems for binding to port 80
# # (or anything < 1024). Capability-based security may be available for
# # your system and worth checking out so you won't need to be root to
# # start nginx to bind on 80
user nobody nogroup; # for systems with a "nogroup"
# user nobody nobody; # for systems with "nobody" as a group instead
# Feel free to change all paths to suite your needs here, of course
pid /path/to/nginx.pid;
error_log /path/to/nginx.error.log;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # "on" if nginx worker_processes > 1
# use epoll; # enable for Linux 2.6+
# use kqueue; # enable for FreeBSD, OSX
}
http {
# nginx will find this file in the config directory set at nginx build time
include mime.types;
# fallback in case we can't determine a type
default_type application/octet-stream;
# click tracking!
access_log /path/to/nginx.access.log combined;
# you generally want to serve static files with nginx since neither
# Unicorn nor Rainbows! is optimized for it at the moment
sendfile on;
tcp_nopush on; # off may be better for *some* Comet/long-poll stuff
tcp_nodelay off; # on may be better for some Comet/long-poll stuff
# we haven't checked to see if Rack::Deflate on the app server is
# faster or not than doing compression via nginx. It's easier
# to configure it all in one place here for static files and also
# to disable gzip for clients who don't get gzip/deflate right.
# There are other gzip settings that may be needed used to deal with
# bad clients out there, see http://wiki.nginx.org/NginxHttpGzipModule
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml;
# this can be any application server, not just Unicorn/Rainbows!
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
server unix:/home/portfolio/tmp/.unicorn.sock fail_timeout=0;
# for TCP setups, point these to your backend servers
# server 192.168.0.7:8080 fail_timeout=0;
# server 192.168.0.8:8080 fail_timeout=0;
# server 192.168.0.9:8080 fail_timeout=0;
}
server {
# enable one of the following if you're on Linux or FreeBSD
listen 80 default deferred; # for Linux
# listen 80 default accept_filter=httpready; # for FreeBSD
# If you have IPv6, you'll likely want to have two separate listeners.
# One on IPv4 only (the default), and another on IPv6 only instead
# of a single dual-stack listener. A dual-stack listener will make
# for ugly IPv4 addresses in $remote_addr (e.g ":ffff:10.0.0.1"
# instead of just "10.0.0.1") and potentially trigger bugs in
# some software.
# listen [::]:80 ipv6only=on; # deferred or accept_filter recommended
client_max_body_size 4G;
server_name _;
# ~2 seconds is often enough for most folks to parse HTML/CSS and
# retrieve needed images/icons/frames, connections are cheap in
# nginx so increasing this is generally safe...
keepalive_timeout 5;
# path for static files
root /var/www/portfolio/public;
# Prefer to serve static files directly from nginx to avoid unnecessary
# data copies from the application server.
#
# try_files directive appeared in in nginx 0.7.27 and has stabilized
# over time. Older versions of nginx (e.g. 0.6.x) requires
# "if (!-f $request_filename)" which was less efficient:
# http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
try_files $uri/index.html $uri.html $uri @app;
location @app {
# an HTTP header important enough to have its own Wikipedia entry:
# http://en.wikipedia.org/wiki/X-Forwarded-For
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# enable this if you forward HTTPS traffic to unicorn,
# this helps Rack set the proper URL scheme for doing redirects:
# proxy_set_header X-Forwarded-Proto $scheme;
# pass the Host: header from the client right along so redirects
# can be set properly within the Rack application
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
# set "proxy_buffering off" *only* for Rainbows! when doing
# Comet/long-poll/streaming. It's also safe to set if you're using
# only serving fast clients with Unicorn + nginx, but not slow
# clients. You normally want nginx to buffer responses to slow
# clients, even with Rails 3.1 streaming because otherwise a slow
# client can become a bottleneck of Unicorn.
#
# The Rack application may also set "X-Accel-Buffering (yes|no)"
# in the response headers do disable/enable buffering on a
# per-response basis.
# proxy_buffering off;
proxy_pass http://app_server;
}
# Rails error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/www/portfolio/public;
}
}
}
types_hash_max_size: 2048;
types_hash_bucket_size: 64;
最佳答案
我用已经安装了 nginx 的 digital ocean 制作了另一个液滴,只是查看了 nginx.conf 文件,他们在 http 部分有这个
types_hash_max_size 2048;
关于ruby-on-rails - 在 digital ocean 上使用 Ubuntu 和 Rails 的 Nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19238122/
我讨厌发布“这应该很容易,我错过了什么”问题,但是......这应该很容易,我错过了什么?我在这个测试代码上没有得到匹配,我不明白为什么。模式是(或应该是)“任何三个数字,后跟任何三个相同的数字,后跟
我在 digital ocean 上部署了一个应用程序,我想更新它的部署源 (github)。我将我的 github 存储库移到了一个组织,现在 digital ocean 似乎无法再访问它了。 我相
我在 digital ocean 上部署了一个应用程序,我想更新它的部署源 (github)。我将我的 github 存储库移到了一个组织,现在 digital ocean 似乎无法再访问它了。 我相
[抱歉,如果这不太适合 SO,Digits 的支持链接到 SO] 在我的 iOS 应用程序中,有些用户使用 Digits 登录,有些则不使用。我仍然希望能够通过 Digits 的联系人匹配使用他们的通
我有这样的查询: SELECT * FROMmesWHERE text REGEXP '#11' 我想获得#11 的所有含义,例如: #11 #11a 但不是数字后面有数字的情况: #112 所以我厌
我有一个 file.txt 看起来像这样: abe abbe cde 45a678 ae cababb 12345 在运行命令 egrep [[:digit:]] file.txt 之后它显示了两个结
我有一个生产服务器 - 一个 Digital Ocean Droplet - 上面运行着一个数据库和网站。我现在想继续制作一个临时服务器。我认为克隆它是一个好主意,但是执行此类操作的好方法是什么? 到
似乎 get.k8s.io 是部署 Kubernetes 集群的推荐方法,但该脚本不支持 Digital Ocean。 有没有一种我错过的替代方法可以在 Digital Ocean 上轻松设置集群?
我有关于 java 正则表达式的查询。实际上,我是正则表达式的新手。所以我需要帮助来为下面的语句形成一个正则表达式: Statement: a-alphanumeri
我对大家有一些特殊的要求。我需要对以下对象数组进行自定义顺序/排序。我需要订购的数组可能类似于以下示例: //array $scope.myArray = [ { orderI
我有一个数字 N。继续对数字求和,直到得到一位数字的结果。例如 35252 ==> 17 ==> 8我写了以下代码: int digitSum(int n) { int sum = 0;
我想允许用户输入以下十进制或整数值 (A) .5 0.500 3 0 0.0 30 500000 4000.22 0. 这是我使用的以下正则表达式: factor: /^-?\d*[.]??\d*$/
我正在使用if语句显示隐藏的div。用户只需按一下按钮即可循环选择他们想要预订的小时数。时间最多可达 10 小时。 if如果 checkHours 则语句会显示通知小于 5。一切都工作得很好,直到用户
如何编写正则表达式来验证此模式? 123456 - correct *1 - correct 1* - correct 124** - correct *1*2 - correct * - corre
所以这就是我想要做的。 在 git 中推送到 master 有 gitlab-ci 听说推送启动管道 管道构建代码并将 docker 容器推送到 gitlab 注册表 管道通过 ssh 登录到 d
myString.match("[\d]*") 对于 12345 和 77777 给出 true 但我正在寻找的结果是 12345 为 false,7777 为 true 最佳答案 (\d)\1*\D
在 iOS 应用程序中安装 Digits 1.15.1 时,AppDelegate.m 文件中出现以下错误: 无法在导入语句中构建模块“DigitsKit”#import 在 [Fabric wit
如何使正则表达式不匹配超过 2 位数的特定数字。例如除 13 以外的任何数字。下面的第二行代码将无法匹配 10、11...,第三行将查找不以 1 开头但具有 3 的数字: str = 'val=13'
我实际上有一个可能看起来很疯狂的问题,但在 WCF 中我有一个简单的契约(Contract),有时当我将 DataContract 设置为小数时,服务会在“.”之后发回 4 位数字。我其实很期待只有2
如果我执行以下操作: et_user_input.setKeyListener(DigitsKeyListener.getInstance("123-+")); et_user_input.setIn
我是一名优秀的程序员,十分优秀!