我真的不知道从哪里开始寻找答案:我按照说明进行操作这里为 Debian 设置 nginx 和 Passenger。(sudo apt-get nginx-extras passenger
)一切正常。然后我尝试设置 ssl:
- 创建服务器密钥等
- 复制 /etc/nginx/sites-available/default 并取消注释并编辑必要的行
- 在 /etc/nginx/sites-enable 中创建了一个符号链接
- 重新启动 nginx
突然,我无法再通过 Firefox 连接到服务器。所以我撤消了上述每个步骤 - 什么也没发生。我卸载了 nginx-extras 和 Passenger,并手动删除了名为“*nginx*”的每个文件和目录,因为我看到整个 /etc/nginx/ 目录仍然存在。然后我再次安装了所有内容 - 仍然一无所获。
即使我以为它已被完全删除,ps waux | grep nginx
但仍出现了以下情况:
USERNAME 3776 0.0 0.1 11292 928 pts/0 S+ 22:15 0:00 grep nginx
有任何想法吗?
nginx.conf:
user www-data;
worker_processes 4;
pid /var/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;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
默认
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
#server_name localhost;
server_name MYSERVERNAME.COM;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
}
}
错误日志
2013/12/18 21:26:11 [info] 4051#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2013-12-18 21:26:11.5154 4052/7f52e36b2720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '4051', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 21:26:11.5256 4055/7f9d793ff720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4051/generation-0/request
[ 2013-12-18 21:26:11.5422 4060/7f356bd97740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4051/generation-0/logging
[ 2013-12-18 21:26:11.5425 4052/7f52e36b2720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
[ 2013-12-18 21:26:12.6104 4085/7fd382f9e720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '4084', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 21:26:12.6212 4088/7f366efae720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4084/generation-0/request
[ 2013-12-18 21:26:12.6372 4093/7fe9334f6740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4084/generation-0/logging
[ 2013-12-18 21:26:12.6376 4085/7fd382f9e720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
2013/12/18 21:29:14 [info] 4342#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
2013/12/18 21:43:58 [info] 3268#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2013-12-18 21:43:58.9454 3269/7ffca390a720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '3268', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 21:43:58.9565 3272/7ff05712f720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.3268/generation-0/request
[ 2013-12-18 21:43:59.0637 3277/7fd1a6566740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.3268/generation-0/logging
[ 2013-12-18 21:43:59.0641 3269/7ffca390a720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
[ 2013-12-18 21:44:00.1272 3302/7f36e741a720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '3301', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 21:44:00.1371 3305/7f39a4c0a720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.3301/generation-0/request
[ 2013-12-18 21:44:00.1516 3310/7f77ac1f2740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.3301/generation-0/logging
[ 2013-12-18 21:44:00.1519 3302/7f36e741a720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
2013/12/18 22:33:42 [info] 4446#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2013-12-18 22:33:42.5973 4447/7f9322eec720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '4446', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 22:33:42.6076 4450/7f4b5421a720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4446/generation-0/request
[ 2013-12-18 22:33:42.6231 4455/7f66ad0d7740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4446/generation-0/logging
[ 2013-12-18 22:33:42.6235 4447/7f9322eec720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
[ 2013-12-18 22:33:42.6937 4478/7f2efc258720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '4469', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 22:33:42.7052 4481/7f22f972e720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4469/generation-0/request
[ 2013-12-18 22:33:42.7225 4486/7f115cf78740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4469/generation-0/logging
[ 2013-12-18 22:33:42.7229 4478/7f2efc258720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
2013/12/18 22:55:00 [info] 4571#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2013-12-18 22:55:00.2297 4572/7fd2593b7720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '4571', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 22:55:00.2402 4575/7fc908843720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4571/generation-0/request
[ 2013-12-18 22:55:00.2552 4580/7fc3a8488740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4571/generation-0/logging
[ 2013-12-18 22:55:00.2556 4572/7fd2593b7720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
[ 2013-12-18 22:55:01.3489 4607/7fdb92fa0720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '4606', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 22:55:01.3590 4610/7fd6ff47d720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4606/generation-0/request
[ 2013-12-18 22:55:01.3746 4615/7f6beae3b740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4606/generation-0/logging
[ 2013-12-18 22:55:01.3750 4607/7fdb92fa0720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
2013/12/18 23:03:27 [info] 4735#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2013-12-18 23:03:27.9453 4736/7fb2f8b7b720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '4735', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 23:03:27.9556 4739/7f8d97b36720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4735/generation-0/request
[ 2013-12-18 23:03:27.9710 4744/7fb89953a740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4735/generation-0/logging
[ 2013-12-18 23:03:27.9714 4736/7fb2f8b7b720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
2013/12/18 23:36:45 [info] 5207#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2013-12-18 23:36:45.0369 5208/7f9b67fc1720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '5207', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 23:36:45.0474 5211/7fc05a851720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.5207/generation-0/request
[ 2013-12-18 23:36:45.0637 5216/7ffc716ae740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.5207/generation-0/logging
[ 2013-12-18 23:36:45.0641 5208/7f9b67fc1720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
[ 2013-12-18 23:36:46.1591 5243/7f29a6ba9720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '5242', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 23:36:46.1697 5246/7f91dc2c2720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.5242/generation-0/request
[ 2013-12-18 23:36:46.1861 5251/7f49ec0d4740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.5242/generation-0/logging
[ 2013-12-18 23:36:46.1865 5243/7f29a6ba9720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
2013/12/18 23:55:06 [info] 5645#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2013-12-18 23:55:06.5135 5646/7f89b653f720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '5645', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 23:55:06.5237 5649/7f25f91cc720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.5645/generation-0/request
[ 2013-12-18 23:55:06.5386 5654/7f470908c740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.5645/generation-0/logging
[ 2013-12-18 23:55:06.5390 5646/7f89b653f720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
[ 2013-12-18 23:55:07.6364 5681/7f482aa8a720 agents/Watchdog/Main.cpp:510 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', 'passenger_version' => '4.0.29', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.29', 'web_server_pid' => '5680', 'web_server_type' => 'nginx', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2013-12-18 23:55:07.6472 5684/7fdd6c28b720 agents/HelperAgent/Main.cpp:625 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.5680/generation-0/request
[ 2013-12-18 23:55:07.6631 5689/7f5d80851740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.5680/generation-0/logging
[ 2013-12-18 23:55:07.6634 5681/7f482aa8a720 agents/Watchdog/Main.cpp:697 ]: All Phusion Passenger agents started!
答案1
我卸载了 nginx-extras 和 Passenger,并手动删除了每个名为“nginx”的文件和目录,因为我看到整个 /etc/nginx/ 目录仍然存在。
这是意料之中的(也是可取的)。包管理器不会删除 /etc 中的配置文件。
甚至当我认为它已被完全删除时,ps waux | grep nginx 仍然产生了这个:USERNAME 3776 0.0 0.1 11292 928 pts/0 S+ 22:15 0:00 grep nginx
是的。该 grep 正在进程列表中检测 grep 命令本身,因为它包含“nginx”。我没有看到任何暗示 nginx 正在运行的内容。
建议:
- 重新安装 nginx-extras 和 Passenger,重新执行您删除的 /etc/nginx 中的配置。
- 运行
sudo service nginx status
以确保它仍在运行。如果没有: - 运行
sudo service nginx start
或sudo service nginx restart
并发布其报告的任何错误消息。
请将配置文件的(已清理)内容与您的问题一起发布。了解已完成的配置会很有帮助,因为我希望您的问题将在这些配置文件中得到修复。