Tom*_*ogg 11 ubuntu ruby-on-rails passenger nginx
我已经尝试了超过一天的时间让Nginx和Passenger为我的Rails应用程序工作,但我得到的只是:Nginx欢迎页面.为什么?
我已经在默认位置安装了Nginx /opt/nginx,如下所示:
# Install passenger gem
$ gem install passenger
# Install dependencies for Nginx/Passenger
$ apt-get install libcurl4-openssl-dev
# Compile it
$ passenger-install-nginx-module
而且(我认为)该文件的相关部分/opt/nginx/conf/nginx.conf如下所示:
http {
    passenger_root /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.29;
    passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p353/ruby;
    server {
        listen       80;
        server_name  www.my-domain.com;
        root /home/deploy/current/public;
        passenger_enabled on;
        location / {
            root   html;
            index  index.html index.htm;
            passenger_enabled on;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
            passenger_enabled on;
        }
        ...
当我检查"根位置"(公共)时,我可以看到应用程序在那里(它与Capistrano一起部署):
$ ls /home/deploy/current/public
404.html  422.html  500.html  assets  css  favicon.ico  js  robots.txt  system
......或1级以上:
$ ls /home/deploy/current
app                  Capfile  config.ru  doc      Gemfile.lock  log  public    resque.pid  script  tmp
assets_manifest.yml  config   db         Gemfile  lib           LOG  Rakefile  REVISION    test    vendor
看看Rails production.log,我可以看到它从未超越编译资产:
$ tail -f /home/deploy/current/log/production.log
Compiled page_specific/some_file_5.css  (137ms)  (pid 28316)
Compiled page_specific/some_file_4.css  (19ms)  (pid 28316)
Compiled page_specific/some_file_3.css  (3ms)  (pid 28316)
Compiled page_specific/some_file_2.css  (3ms)  (pid 28316)
Compiled page_specific/some_file_1.css  (16ms)  (pid 28316)
Compiled application.css  (3131ms)  (pid 28316)
看看Nginx error.log,我看不出任何错误(正常访问URL("主页")似乎没有创建任何条目):
$ tail -f /opt/nginx/logs/error.log
看看Nginx access.log,我看不出任何错误(正常访问URL("主页")似乎没有创建任何条目):
$ tail -f /opt/nginx/logs/error.log
[ 2013-12-29 01:16:55.6792 2099/7fa534fca740 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
也:
#access_log  logs/access.log  main;没有取消注释#log_format  main,它抱怨)这可能有什么问题?
Tom*_*ogg 12
圣洁的.显然需要它才能使其工作:
注释掉/删除安装期间默认添加的"location /"指令:
    # location / {
    #     root   html;
    #     index  index.html index.htm;
    #     passenger_enabled on;
    # }
(如果有人知道为什么,我有兴趣知道.)
| 归档时间: | 
 | 
| 查看次数: | 7708 次 | 
| 最近记录: |