在阿里云上部署 rails 时,总是出现:We're sorry, but something went wrong。
重装了五遍系统,谷歌尝试多次,但是仍然报错。
所以发帖请求大神们的帮助。非常感谢。
server {
listen 80;
server_name eyulaodu.com;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/myapp/code/public;
# Turn on Passenger
passenger_enabled on;
passenger_ruby /usr/local/rvm/gems/ruby-2.3.1/wrappers/ruby;
}
2 . /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
include /etc/nginx/passenger.conf;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#}
3 . /etc/nginx/passenger.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/local/rvm/gems/ruby-2.3.1/wrappers/ruby;
1 . sudo tail /var/log/nginx/error.log 后终端显示:
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
[ 2017-06-06 12:32:48.1369 19796/7f20b7896700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-15] Cannot checkout session because a spawning error occurred. The identifier of the error is 534dd085. Please see earlier logs for details about the error.
2 . sudo service nginx restart 重启服务器,再次运行 sudo tail /var/log/nginx/error.log 后终端显示:
[ 2017-06-06 12:46:42.4406 19802/7feb0a296780 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2017-06-06 12:46:42.4663 19796/7f20be491780 age/Cor/CoreMain.cpp:1055 ]: Passenger core shutdown finished
2017/06/06 12:46:43 [info] 20926#20926: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:71
[ 2017-06-06 12:46:43.4941 20935/7fd0a9296780 age/Wat/WatchdogMain.cpp:1281 ]: Starting Passenger watchdog...
[ 2017-06-06 12:46:43.5017 20938/7fd91419b780 age/Cor/CoreMain.cpp:1070 ]: Starting Passenger core...
[ 2017-06-06 12:46:43.5018 20938/7fd91419b780 age/Cor/CoreMain.cpp:245 ]: Passenger core running in multi-application mode.
[ 2017-06-06 12:46:43.5047 20938/7fd91419b780 age/Cor/CoreMain.cpp:820 ]: Passenger core online, PID 20938
[ 2017-06-06 12:46:43.5125 20944/7f5a4e2d9780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2017-06-06 12:46:43.5130 20944/7f5a4e2d9780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 20944
[ 2017-06-06 12:46:48.6531 20938/7fd9140ac700 age/Cor/SecurityUpdateChecker.h:356 ]: Security update check: no update found (next check in 24 hours)
3 . tail -f log/production.log 后显示:
D, [2017-06-05T21:46:47.385590 #18316] DEBUG -- : (6.0ms) commit transaction
I, [2017-06-05T21:46:47.385649 #18316] INFO -- : Migrating to CreateGroupRelationships (20170531100224)
D, [2017-06-05T21:46:47.386154 #18316] DEBUG -- : (0.0ms) begin transaction
D, [2017-06-05T21:46:47.386869 #18316] DEBUG -- : (0.2ms) CREATE TABLE "group_relationships" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "group_id" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
D, [2017-06-05T21:46:47.387607 #18316] DEBUG -- : SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20170531100224"]]
D, [2017-06-05T21:46:47.397393 #18316] DEBUG -- : (9.6ms) commit transaction
D, [2017-06-05T21:46:47.399630 #18316] DEBUG -- : ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
D, [2017-06-05T21:46:47.402587 #18316] DEBUG -- : (0.0ms) begin transaction
D, [2017-06-05T21:46:47.403546 #18316] DEBUG -- : SQL (0.2ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "production"], ["created_at", "2017-06-05 13:46:47.402770"], ["updated_at", "2017-06-05 13:46:47.402770"]]
D, [2017-06-05T21:46:47.407726 #18316] DEBUG -- : (4.0ms) commit transaction
4 . systemctl status nginx.service 服务器状态:
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-06-06 13:06:25 CST; 2min 17s ago
Process: 21188 ExecStop=/bin/sleep 1 (code=exited, status=0/SUCCESS)
Process: 21183 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry TERM/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCE
Process: 21200 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 21195 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 21223 (nginx)
CGroup: /system.slice/nginx.service
├─21203 Passenger watchdog
├─21206 Passenger core
├─21212 Passenger ust-router
├─21223 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
└─21228 nginx: worker process
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: Stopped A high performance web server and a reverse proxy server.
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: Started A high performance web server and a reverse proxy server.
5 journalctl -xe
Jun 06 13:06:24 iZuf6fe5v25797lljd3j1zZ systemd[1]: Stopping A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun shutting down.
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: Stopped A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has finished shutting down.
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: Starting A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun starting up.
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ systemd[1]: Started A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has finished starting up.
--
-- The start-up result is done.
Jun 06 13:06:25 iZuf6fe5v25797lljd3j1zZ sudo[21176]: pam_unix(sudo:session): session closed for user root
Jun 06 13:15:01 iZuf6fe5v25797lljd3j1zZ CRON[21276]: pam_unix(cron:session): session opened for user root by (uid=0)
Jun 06 13:15:01 iZuf6fe5v25797lljd3j1zZ CRON[21277]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 06 13:15:01 iZuf6fe5v25797lljd3j1zZ CRON[21276]: pam_unix(cron:session): session closed for user root
Jun 06 13:17:01 iZuf6fe5v25797lljd3j1zZ CRON[21279]: pam_unix(cron:session): session opened for user root by (uid=0)
Jun 06 13:17:01 iZuf6fe5v25797lljd3j1zZ CRON[21280]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 06 13:17:01 iZuf6fe5v25797lljd3j1zZ CRON[21279]: pam_unix(cron:session): session closed for user root