小编And*_*roz的帖子

NGINX未在Amazon EC2实例上显示默认页面

我在Fedora上安装了nginx.但我不知道为什么我不能通过浏览器请求服务器IP来获取默认的nginx页面.我的请求因超时而下降.

但是nginx正在运行.

$ sudo service nginx status
nginx (pid  20372) is running...
Run Code Online (Sandbox Code Playgroud)

我的默认生成配置是

# 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 auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load …
Run Code Online (Sandbox Code Playgroud)

linux nginx amazon-ec2

7
推荐指数
1
解决办法
2604
查看次数

Rails关注如何从InstanceMethod调用ClassMethods

我需要从实例方法调用weight_to_kg 方法.

我想为我的很多模型创建重量到kg转换器,它的重量列以磅为单位.

module WeightConvertor
  extend ActiveSupport::Concern

  def weight_kg
    # I need to call weight_to_kg method
    ClassMethods.weight_to_kg(weight) # does not work
  end

  module ClassMethods
    def weight_to_kg(weight)
    end
  end
end

class Order < ActiveRecord::Base
  include WeightConvertor
  # weight column is present
end

Order.first.weight
Order.first.weight_kg
Run Code Online (Sandbox Code Playgroud)

我该怎么做?

ruby ruby-on-rails activesupport-concern

1
推荐指数
1
解决办法
1616
查看次数