gpt4 book ai didi

ruby-on-rails - 部署后我看到标准 nginx 的 "It works!"

转载 作者:行者123 更新时间:2023-12-04 06:05:53 35 4
gpt4 key购买 nike

我已经将带有 Capistrano 的 Rails 应用程序部署到 VPS,当我尝试使用“APP_NAME.com”访问它时,我看到标准 Nginx 的“它有效!”页。

我试图删除 index.html文件来自 /var/www文件夹,现在我看到其中的文件夹:apps , logtmp .

nginx.conf我有:

user nginx web;

pid /var/run/nginx.pid;
error_log /var/www/log/nginx.error.log;

events {
worker_connections 1024;
accept_mutex off;
use epoll;
}

http {
include mime.types;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
default_type application/octet-stream;
access_log /var/www/log/nginx.access.log combined;
sendfile on;
tcp_nopush on; # off may be better for *some* Comet/long-poll stuff
tcp_nodelay off; # on may be better for some Comet/long-poll stuff

gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 0;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
gzip_proxied expired no-cache no-store private auth;
gzip_comp_level 9;
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml;

upstream app_server {
server unix:/var/www/apps/APP_NAME/socket/.unicorn.sock fail_timeout=0;
}

server {

pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;

location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}

location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }

location /ngx_pagespeed_statistics {
allow 127.0.0.1; allow 5.228.169.73; deny all;
}

location /ngx_pagespeed_global_statistics {
allow 127.0.0.1; allow 5.228.169.73; deny all;
}

pagespeed MessageBufferSize 100000;

location /ngx_pagespeed_message {
allow 127.0.0.1; allow 5.228.169.73; deny all;
}

location /pagespeed_console {
allow 127.0.0.1; allow 5.228.169.73; deny all;
}

charset utf-8;
listen 80 default deferred; # for Linux
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
root /var/www/apps/APP_NAME/current/public;
try_files $uri/index.html $uri.html $uri @app;

location ~ ^/(assets)/ {
root /var/www/apps/APP_NAME/current/public;
expires max;
add_header Cache-Control public;
}

location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}

error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/www/apps/APP_NAME/current/public;
}
}
}

我在 nginx.conf 中遗漏了什么吗?或在其他文件中?

另外,当我停止 nginx 服务器时,这没有意义,我看到了相同的页面。

我不擅长将应用程序部署到服务器,这是我第一次没有 Heroku,所以我不知道你到底需要知道什么来帮助解决我的问题。因此,如果您需要任何其他信息,请询问,我会将其添加到问题中。

谢谢!

最佳答案

所以,我从 this answer 找到了解决方案.问题出在 Apache Web 服务器上,它在后台运行并阻止 Nginx 在 80 端口上运行。

我已经停止了 Apache 服务器并重新启动了 Nginx,现在一切正常:

sudo apachectl stop
sudo restart nginx

关于ruby-on-rails - 部署后我看到标准 nginx 的 "It works!",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26151308/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com