我已经使用Capistrano,Nginx,Passenger设置并部署了应用程序,并设置了服务器和ngnix配置文件,但是,我仍然看到Welcome to ngnix
欢迎屏幕。
这是/etc/nginx/sites-enabled/default
文件中的内容
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name IP;
passenger_enabled on;
rails_env production;
root /home/poladmin/poetry-out-loud-v2/current/public/;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
我已经重新启动了Ngnix,但仍然看不到该网站。
答案 0 :(得分:0)
像Nginx这样的声音正在从安装目录中为您提供内容。通常是/usr/share/nginx
,但您可以通过运行以下命令进行确认:
nginx -V 2>&1 | tr ' ' '\n' | grep prefix
如果无法从您的配置中找到更合适的服务器,则会发生这种情况。以下是一些观察结果:
server_name IP;
此指令告诉Nginx客户端请求中要匹配的主机名,以便将请求传递到此服务器。因此,对http://ip
的请求将在此处处理,是您的意图吗?
您的根目录确实在某人的主目录结构内吗?足够公平...
您可能会丢失该指令的尾部斜杠以使其成为
root /home/poladmin/poetry-out-loud-v2/current/public;
但是,斜杠呢?
它住在这里:
location / {
blah blah blah...
}
除包含location = /50x.html
的{{1}}外,您目前没有位置指令,因此仅是完全匹配项。对于任何其他URL的请求在此服务器块中都没有匹配的位置。
答案 1 :(得分:0)
使用以下命令尝试
第一:service nginx configtest
验证Nginx是否正常运行
秒:service nginx restart