Ubuntu+Nginx+Thin+Rails
apt 安装 apt-get install nginx
启动/停止 service nginx start/stop
默认配置 /etc/nginx/nginx.conf
welcome page /etc/nginx/sites-available/default
default root /usr/share/nginx
nginx -c file_path #按指定文件启动
nginx 配置文件
http {
......
upstream www.suxu.info {
server 127.0.0.1:3000;
server 127.0.0.2:3001;
}
server {
listen 80;
server_name www.suxu.info;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
root /root/apps/www.suxu.info/current/public/;
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;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass https://www.suxu.info;
break;
}
}
}
......
}