#5 楼 @jimrokliu 不是云…物理主机 hyper-V 里的
#4 楼 @small_fish__ 写 issue 点赞…这是个技术活…
新官网设计更了嘿~
#3 楼 @greatghoul 谢谢分享!
尝试过用 webkit 直接用 blur 滤镜做毛玻璃…但是浏览器仅限于 chrome,而且性能开支很大,范围大还会卡…这也就是为啥现在网页上很少见到毛玻璃…
worker_processes 4
app_root = File.expand_path("../..", __FILE__)
working_directory app_root
# Listen on fs socket for better performancelisten "/tmp/unicorn.sock", :backlog => 64
# Nuke workers after 30 seconds instead of 60 seconds (the default)
timeout 30
# App PID
pid "#{app_root}/tmp/pids/unicorn.pid"
# By default, the Unicorn logger will write to stderr.
# Additionally, some applications/frameworks log to stderr or stdout,
# so prevent them from going to /dev/null when daemonized here:
stderr_path "#{app_root}/log/unicorn.stderr.log"
stdout_path "#{app_root}/log/unicorn.stdout.log"
# To save some memory and improve performance
preload_app true
GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true
# Force the bundler gemfile environment variable to
# reference the Сapistrano "current" symlinkbefore_exec do |_|
ENV["BUNDLE_GEMFILE"] = File.join(app_root, 'Gemfile')
end
before_fork do |server, worker|
# 参考 http://unicorn.bogomips.org/SIGNALS.html
# 使用USR2信号,以及在进程完成后用QUIT信号来实现无缝重启
old_pid = app_root + '/tmp/pids/unicorn.pid.oldbin'
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
# the following is highly recomended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
# 禁止GC,配合后续的OOB,来减少请求的执行时间
GC.disable
# the following is *required* for Rails + "preload_app true",
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
Nginx 的配置是
upstream writings-unicorn {
server unix:/tmp/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name writings.xxx.com;
root /var/mirrors/writing/public;
try_files $uri $uri/index.html @user2;
location @user3 {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://writings-unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
依然子域名访问失败… dns 上 writings 和*.writings 全指向这台服务器,用端口模式访问的时候子域名正常,用 socket 就出问题了……很纠结…看来应该是 unicorn 配置问题…
有开源的项目么?求学习一下……
看完好激动!对多终端适配最感兴趣!
换成 thin 或者 puma
#24 楼 @cassiuschen 我是想降低语言学习成本…毕竟开发中语言只是载体不是目的…