nginx rails 详细站点配置入门教程
在nginx rails ruby thin 等软件都安装好的情况下 ubuntu server下的配置
首先配置nginx
upstream blog.hhailuo.com { #用端口方式去启动网站 用rails s -p3000 # server 127.0.0.1:3000; # 用sock方式去启动网站 用thin服务器(个人推荐) server unix:/var/www/app/tmp/sockets/appname .0.sock; server unix:/var/www/app/tmp/sockets/appname .1.sock; server unix:/var/www/app /tmp/sockets/appname .2.sock; } server { listen 80; server_name blog.hhailuo.com; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /var/www/app; 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 http://blog.hhailuo.com ; break; } } }
再用开三个 thin
thin start –server 3 –socket tmp/sockets/appname.sock -e production 创建软连接 ln -s /etc/nginx/sites-available/file /etc/nginx/sites-enabled/file
重启nginx
# service nginx restart
相关推荐
wl00 2020-10-28
EricNet 2020-07-05
EricNet 2020-05-27
何志文 2020-05-11
JOO 2020-04-26
happyfreeangel 2020-04-09
Poisedflw 2020-03-23
yangliuhbhd 2020-03-06
Ben的程序员生涯 2013-06-01
chenshuixian 2013-06-01
wes0 2014-05-31
mrice00 2019-12-20
EricNet 2019-12-11
89304896 2019-12-08
lihaoningxia 2013-07-09
userguanguan 2015-03-16