全球主机交流论坛

标题: 用了几年的 Nginx 反代配置 以前好好的 这次老是提示错误 [打印本页]

作者: j6hokqgfrr    时间: 2023-12-9 23:29
标题: 用了几年的 Nginx 反代配置 以前好好的 这次老是提示错误
用了几年的 Nginx 反代配置 以前一直用得好好的 这次老是提示错误
不晓得哪里出了问题 哪位大哥大佬帮看看 哪里出错了
sudo nginx -t
nginx: [emerg] invalid number of arguments in "proxy_set_header" directive in /etc/nginx/conf.d/5000.conf:7
nginx: configuration file /etc/nginx/nginx.conf test failed

server {
    listen 80;
    server_name 02.hfgdfg.site;
    client_max_body_size 51200M;
location / {
        proxy_pass http://127.0.0.1:6666;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
    }
}
作者: 胖虎_    时间: 2023-12-9 23:32
/etc/nginx/conf.d/5000.conf:7  这个文件贴出来,他这上面意思是不是说这个文件的第七行有问题呀
作者: lanying    时间: 2023-12-9 23:33
51200M是不是它太大了
作者: 蒙面人    时间: 2023-12-9 23:34
胖虎_ 发表于 2023-12-9 23:32
/etc/nginx/conf.d/5000.conf:7  这个文件贴出来,他这上面意思是不是说这个文件的第七行有问题呀 ...

是的。
作者: j6hokqgfrr    时间: 2023-12-10 00:52
胖虎_ 发表于 2023-12-9 23:32
/etc/nginx/conf.d/5000.conf:7  这个文件贴出来,他这上面意思是不是说这个文件的第七行有问题呀 ...

cat /etc/nginx/conf.d/5000.conf
server {
    listen 80;
    server_name 02.hd**.site;
    client_max_body_size 51200M;
location / {
        proxy_pass http://127.0.0.1:6666;
        proxy_set_header X-Real-IP ;
        proxy_set_header REMOTE-HOST ;
        proxy_set_header X-Forwarded-For ;
        proxy_set_header Host ;
        proxy_redirect off;
    }
}

作者: j6hokqgfrr    时间: 2023-12-10 00:55
j6hokqgfrr 发表于 2023-12-10 00:52
cat /etc/nginx/conf.d/5000.conf
server {
    listen 80;

不晓得哪里出问题了
之前一直用得好好的

作者: j6hokqgfrr    时间: 2023-12-10 01:05
胖虎_ 发表于 2023-12-9 23:32
/etc/nginx/conf.d/5000.conf:7  这个文件贴出来,他这上面意思是不是说这个文件的第七行有问题呀 ...

谢谢
搞定了
我之前使用命令 cat > /etc/nginx/conf.d/5000.conf << EOF
写入的
手工编辑写入就没事了
作者: Waylon    时间: 2023-12-10 20:45
j6hokqgfrr 发表于 2023-12-10 01:05
谢谢
搞定了
我之前使用命令 cat > /etc/nginx/conf.d/5000.conf


有 $ 符号的时候
eof要加引号 'EOF'




欢迎光临 全球主机交流论坛 (https://loc.wget.at/) Powered by Discuz! X3.4