【发布时间】:2014-08-01 09:56:15
【问题描述】:
您好,我正在学习如何在 VPS 中部署 rails 应用程序,我已按照https://coderwall.com/p/yz8cha 这个教程进行操作,一切正常,我遇到了一些错误并通过搜索网络纠正了它们,一切正常 capistrano 部署文件和文件夹到 VPS,如果我更改任何代码,然后在类型 cap deploy 之后它也会在 VPS 中更改,一切正常,终端中没有显示错误,但问题是 nginx 服务器没有运行(在初始阶段它显示它索引页面 - 欢迎使用 nginx),我不知道哪里可能出现问题,我必须做的任何帮助将不胜感激,,我正在使用 rails 4.1.4,ruby 2.1.2,capistrano(2.15.5)如果它的问题..
我不知道这里必须显示哪些代码如果您想查看我渴望向您展示的任何代码....这是我的 nginx.conf 文件
upstream unicorn {
server unix:/tmp/unicorn.projectname.sock fail_timeout=0;
}
server {
listen 80 default_server deferred;
# server_name example.com;
root /home/administrator/apps/testvps/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 20M;
keepalive_timeout 10;
}
这是我在 VPS 终端中 nginx -t 时遇到的错误
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2014/08/01 15:40:35 [warn] 5682#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2014/08/01 15:40:35 [emerg] 5682#0: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed
【问题讨论】:
-
将您的
nginx.conf文件内容粘贴到您的问题中 -
是的 Raj,在启用 vps IN 站点时看到我的 nginx 文件夹时,rails 应用程序中有一个用于 nginx.conf 文件的链接文件,但如果我点击该文件,它会显示链接已损坏跨度>
-
好的.. 让我知道
nginx -t命令的输出。在服务端运行 -
发布了我从终端得到的命令
标签: ruby-on-rails nginx capistrano unicorn