我在Ubuntu 17安装后没有收到欢迎页面,只是在Chrome上显示“此页面无法正常工作......ERR_EMPTY_RESPONSE”
以下是我的设置:
sudo ufw禁用
在系统启动时停止并禁用防火墙
服务已启动并正在运行
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/nginx.service.d
└─override.conf
Active: active (running) since Thu 2018-02-22 10:22:31 UTC; 1min 6s ago
Process: 1356 ExecStartPost=/bin/sleep 0.1 (code=exited, status=0/SUCCESS)
Process: 1270 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 1167 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 1339 (nginx)
Tasks: 2
Memory: 9.2M
CPU: 32ms
CGroup: /system.slice/nginx.service
├─1339 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
└─1345 nginx: worker process
Feb 22 10:22:29 jitsinew systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 22 10:22:31 jitsinew systemd[1]: Started A high performance web server and a reverse proxy server.
所有配置都是默认配置,如下所示:
{
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
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";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
在/ etc / nginx / sites-enabled /下有一个名为default的文件,配置如下:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
有什么想法吗?
答案 0 :(得分:0)
我遇到了同样的问题,但我刚刚通过键入 service nginx start
来启动服务器,然后在我的浏览器中键入 localhost 来启动 nginx 并且它工作正常。
答案 1 :(得分:0)
添加
index index.html index.htm index.nginx-debian.html;
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}