我有以下可运行的配置
我的nginx.conf
worker_processes 4;
pid /run/nginx.pid;
events {}
http {
server {
listen 443 ssl;
server_name host.com;
access_log /var/log/nginx/host.access.log;
proxy_set_header X-Forwarded-Host $host;
ssl_certificate /etc/ssl/host.com.crt;
ssl_certificate_key /etc/ssl/host.com.key;
location / {
proxy_pass http://other-host.com/;
}
}
}
我正在尝试做类似的事情
我的nginx.conf
worker_processes 4;
pid /run/nginx.pid;
events {}
http {
include front/*
}
我的front/host.com.conf
server {
listen 443 ssl;
server_name host.com;
access_log /var/log/nginx/host.access.log;
proxy_set_header X-Forwarded-Host $host;
ssl_certificate /etc/ssl/host.com.crt;
ssl_certificate_key /etc/ssl/host.com.key;
location / {
proxy_pass http://other-host.com/;
}
}
在这种情况下,我出现错误 525,我不明白为什么,配置应该完全相同
答案1
或许这只是复制粘贴错误,但由于忘记了包含后的“;”,您的配置将无法工作。
worker_processes 4;
pid /run/nginx.pid;
events {}
http {
include front/*;
}