@
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;
}
}
}