nignx 的 sites-available 配置如下:
upstream myapp {
server unix:/tmp/unicorn.hmp.sock;
}
server {
listen 80;
server_name hmp;
access_log /home/git/deploy/current/log/access.log;
error_log /home/git/deploy/current/log/error.log;
#root /home/git/hmp;
index index.html;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
try_files /system/maintenance.html $uri $uri/index.html $uri.html @user1;
}
location @user2 {
proxy_pass http://myapp;
}
}
unicorn 文件如下:
worker_processes 1
APP_PATH = "/home/git/deploy/current"
working_directory APP_PATH
#/tmp/unicorn.rhea.sock; 这个sock来自 nginx的配置
listen "/tmp/unicorn.hmp.sock", :backlog => 64
listen 8000, :tcp_nopush => true
pid APP_PATH + "/tmp/pids/unicorn.pid"
stderr_path APP_PATH + "/log/unicorn.stderr.log"
stdout_path APP_PATH + "/log/unicorn.stderr.log"
如果直接访问 192.168.1.3 加载页面速度很快,但是 192.168.1.3:8000 这样访问会变的很慢,这是什么原因 各位帮忙看一下,谢谢。