V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  yaocf  ›  全部回复第 2 页 / 共 2 页
回复总数  23
1  2  
2020-03-21 06:46:06 +08:00
回复了 yaocf 创建的主题 NGINX 求助: nginx 无法获取内置变量的值
@yaocf
可能是使用 cat <<EOF EOF 写入配置文件的原因,纠正一下,不需要加\。原先的配置文件应该是正确的。
2020-03-20 21:45:09 +08:00
回复了 yaocf 创建的主题 NGINX 求助: nginx 无法获取内置变量的值
@crystom 恩,谢谢,好不容易编译出了带调试模式的 nginx,看了下调试日志,问题找到了。配置文件中所有的 $ 换成 \$ 就行了。不知道为什么要转义一下才能用。按理说 nginx 的配置文件读取模块应该会考虑到这个吧。

新的配置文件如下,也希望可以帮到有同样问题的小伙伴。

user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
error_log /var/log/nginx/error.log;

events {
worker_connections 1024;
multi_accept on;
}
http {
tcp_nodelay on;
log_format main '\$remote_addr - \$remote_user [\$time_local] \$status '
'"\$request" \$body_bytes_sent "\$http_referer" '
'"\$http_user_agent" "\$http_x_forwarded_for" "\$host\$request_uri"';
access_log /var/log/nginx/access.log main;
server {
listen 80;
location ~/\.well-known* {
#root /usr/lib/mylibs/acme_tiny;
alias /usr/lib/mylibs/acme_tiny/.well-known/;
autoindex on;
}
location ~/* {
rewrite ^(.*) https://\$host\$request_uri break;
}
}
}
2020-03-07 20:29:58 +08:00
回复了 yaocf 创建的主题 NGINX 求助: nginx 无法获取内置变量的值
user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
error_log /var/log/nginx/error.log;

events {
worker_connections 1024;
multi_accept on;
}
http {
tcp_nodelay on;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$host$request_uri"';
access_log /var/log/nginx/access.log main;
server {
listen 80;
location ~/\.well-known* {
root /usr/lib/mylibs/acme_tiny;
#alias /usr/lib/mylibs/acme_tiny/.well-known/;
autoindex on;
}
location ~/* {
rewrite ^(.*) https://$host$request_uri break;
#return 301 https://$host$request_uri;
}
}
}
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5826 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 06:24 · PVG 14:24 · LAX 23:24 · JFK 02:24
Developed with CodeLauncher
♥ Do have faith in what you're doing.