需要将系统从 HTTP 1.1 切换到 HTTP 2。我按照说明进行操作,这些说明可在此处的链接中找到。我选择了“使用必要的选项从源代码重新编译 Nginx”选项。我按照说明做了一切,一切都很好,我去了现场。而且它不起作用,好像服务器没有运行一样。进行了状态检查并获得了屏幕截图 #1
错误日志
2018/11/22 15:32:55 [notice] 20094#20094: signal process started
2018/11/22 15:44:32 [notice] 21071#21071: signal process started
操作系统: debian;
问:怎么回事,在哪里挖?
/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
/etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
补充: 重新启动服务器并出现错误(屏幕截图中没有) - 一切都很好。但是站点不工作(好像服务器没有打开)
最简单的配置。
分别:
listen
-ip
在您的服务器之外server_name
- 网站名称proxy_pass
- 请求被代理的地方(例如这里localhost
),尽管它也可以是123.123.123.123
如果站点文件在服务器上,那么您可以不使用代理,例如:
一方面,所有配置大致相同,但存在差异,不了解它们就无法纠正错误。
块层次结构如下: