• #1楼 @sefier #1楼 @sefier 直接取消 forgery_protection_origin_check 有点太粗暴了。

    修改了 nginx.conf

    user root;
    worker_processes 4;
    pid /var/www/pids/nginx.pid;
    daemon off;
    
    events {
        worker_connections 768;
        # multi_accept on;
    }
    
    http {
    
        ##
        # Basic Settings
        ##
    
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;
    
        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;
    
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
    
        ##
        # Logging Settings
        ##
    
        access_log /var/www/log/nginx-access.log;
      error_log /var/www/log/nginx-error.log;
    
        ##
        # Gzip Settings
        ##
    
        gzip on;
        gzip_disable "msie6";
    
        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    
        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##
    
        #include /etc/nginx/naxsi_core.rules;
    
        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##
    
        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;
    
        ##
        # Virtual Host Configs
        ##
    
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
    }
    
    
    #mail {
    #   # See sample authentication script at:
    #   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
    #
    #   # auth_http localhost/auth.php;
    #   # pop3_capabilities "TOP" "USER";
    #   # imap_capabilities "IMAP4rev1" "UIDPLUS";
    #
    #   server {
    #       listen     localhost:110;
    #       protocol   pop3;
    #       proxy      on;
    #   }
    #
    #   server {
    #       listen     localhost:143;
    #       protocol   imap;
    #       proxy      on;
    #   }
    #}
    
    upstream [app]_backend {
      server app:7000 fail_timeout=0;
      keepalive 3;
    }
    
    server {
      listen 80;
      listen 443 ssl http2;
      server_name [xxx];
    
      # ~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/[app]/public;
      access_log /var/www/log/[app]-access.log;
      error_log  /var/www/log/[app]-error.log;
    
      # this rewrites all the requests to the maintenance.html
      # page if it exists in the doc root. This is for capistrano's
      # disable web task
      if (-f $document_root/maintenance.html) {
        rewrite  ^(.*)$  /maintenance.html last;
        break;
      }
    
      location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
    
        # If the file exists as a static file serve it directly without
        # running all the other rewrite tests on it
        if (-f $request_filename) {
          break;
        }
    
        # check for index.html for directory index
        # if it's there on the filesystem then rewrite
        # the url to add /index.html to the end of it
        # and then break to send it to the next config rules.
        if (-f $request_filename/index.html) {
          rewrite (.*) $1/index.html break;
        }
    
        # this is the meat of the rack page caching config
        # it adds .html to the end of the url and then checks
        # the filesystem for that file. If it exists, then we
        # rewrite the url to have explicit .html on the end
        # and then send it on its way to the next config rule.
        # if there is no file on the fs then it sets all the
        # necessary headers and proxies to our upstream pumas
        if (-f $request_filename.html) {
          rewrite (.*) $1.html break;
        }
    
        if (!-f $request_filename) {
          proxy_pass http://[app]_backend;
          break;
        }
      }
    
      # Now this supposedly should work as it gets the filenames with querystrings that Rails provides.
      # BUT there's a chance it could break the ajax calls.
      location ~* \.(ico|css|gif|jpe?g|png|js)(\?[0-9]+)?$ {
         expires max;
         break;
      }
    
      # Error pages
      # error_page 500 502 503 504 /500.html;
      location = /500.html {
        root /var/www/[app]/public;
      }
    }
    
  • #6楼 @xamenglv 哈哈,当时跟你们技术负责人谈的好不开心哦,如果是你你应该记得我。 目前肉身在海外,圣诞回国,可能在济南呆一两天,到时候可以面基 ^

  • 电面过贵司,虽然最后没有去简直,但是作为老乡支持一个。 公司的电商平台:http://meiguogouwu.com 貌似最近改版过,不错!

  • 超喜欢台湾,可惜大学毕业之后就不能办自由行签证了,哎

  • #1楼 @lithium4010 任何名字都会这样

  • PHP 核心开发者 Laruence(鸟哥)在 QCon 2015 上说了这么一段话(大意):

    我曾经用了PHP和某高级语言做 hello world 的 benchmark ,结果某高级语言胜过 PHP 一个数量级。 然后我分别添加了一条 SQL 查询,它们变成了一个数量级,但是某高级语言还是比 PHP 快两三倍。 然后又加到 10 条 SQL 查询,他们几乎没区别了。

    https://www.v2ex.com/t/191046

  • 我是 docker 新手。好像 docker 的最佳实践就是每次重新 build

  • 新手路过。对于我来说,用 RoR 的一大关键原因在于 ActiveRecord

  • Rails 配置 WebPack 终极篇 at 2016年4月11日

    #10楼 @citysheep 好的,多谢!

  • Rails 配置 WebPack 终极篇 at 2016年4月08日

    #4楼 @citysheep react_on_rails 现在可以用 CommonJS 那种方式引入了吗?以前不可以这样的。。。