solo nginx 部署 登陆后台失败

问题描述

使用 docker 部署,运行命令如下

docker run --detach --name solo --network=host \
	--env RUNTIME_DB="MYSQL" \
	--env JDBC_USERNAME="solo" \
	--env JDBC_PASSWORD="123456wxxZJ!" \
	--env JDBC_DRIVER="com.mysql.cj.jdbc.Driver" \
	--env JDBC_URL="jdbc:mysql://127.0.0.1:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC" \
	b3log/solo --listen_port=8080 --server_scheme=http --server_host=blog.wxxpersonal.top --server_port=

chrome 浏览器隐身模式访问域名,正常。(远程地址为 127.0.0.1,这个不知道算不算正常,如果不正常的话请指出)

image.png

继续登陆,正常

image.png

输入账号密码点击登陆,然后就爆 500 了

image.png

网络请求如下

请求网址:
https://ld246.com/login?goto=http://blog.wxxpersonal.top/login/callback&state=NDmRiOtdUlXIMxSm&v=4.4.0
请求方法:
POST
状态代码:
200 OK
远程地址:
127.0.0.1:7890
引荐来源网址政策:
strict-origin-when-cross-origin

请求网址:
https://ld246.com/login?goto=http://blog.wxxpersonal.top/login/callback&state=NDmRiOtdUlXIMxSm&v=4.4.0
请求方法:
GET
状态代码:
302 Found
远程地址:
127.0.0.1:7890
引荐来源网址政策:
strict-origin-when-cross-origin

请求网址:
http://blog.wxxpersonal.top/login/callback?state=NDmRiOtdUlXIMxSm&access_token=VVg7FDyRE0JtflmB
请求方法:
GET
状态代码:
500 Internal Server Error
远程地址:
127.0.0.1:7890
引荐来源网址政策:
strict-origin-when-cross-origin

求解,24 小时在线几乎秒回,每一条回复都会看,感谢

docker solo 日志如下

......

{"log":"[WARN ]-[2024-08-13 13:59:09]-[org.b3log.solo.service.InitService:150]: Solo has not been initialized, please open your browser to init Solo\n","stream":"stdout","time":"2024-08-13T05:59:09.539822971Z"}
{"log":"[INFO ]-[2024-08-13 13:59:46]-[org.b3log.solo.util.Skins:73]: Loaded template from classpath\n","stream":"stdout","time":"2024-08-13T05:59:46.685959372Z"}
{"log":"[WARN ]-[2024-08-13 14:00:03]-[org.b3log.solo.processor.OAuthProcessor:137]: Can't get user info with token [x5kIdyOX4bqJNx1E]\n","stream":"stdout","time":"2024-08-13T06:00:03.564197103Z"}
{"log":"[ERROR]-[2024-08-13 14:00:03]-[org.b3log.solo.service.DataModelService:637]: Fills blog header failed\n","stream":"stdout","time":"2024-08-13T06:00:03.58649476Z"}
{"log":"java.lang.NullPointerException: Cannot invoke "org.json.JSONObject.getInt(String)" because "preference" is null\n","stream":"stdout","time":"2024-08-13T06:00:03.586528727Z"}
{"log":"\u0009at org.b3log.solo.service.DataModelService.fillBlogHeader(DataModelService.java:602) [solo/:?]\n","stream":"stdout","time":"2024-08-13T06:00:03.586533302Z"}
{"log":"\u0009at org.b3log.solo.service.DataModelService.fillCommon(DataModelService.java:485) [solo/:?]\n","stream":"stdout","time":"2024-08-13T06:00:03.586537464Z"}
{"log":"\u0009at org.b3log.solo.service.DataModelService

.......

{"log":"[ERROR]-[2024-08-13 14:00:03]-[org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer:104]: Renders template [error/401.ftl] failed [Request [\n","stream":"stdout","time":"2024-08-13T06:00:03.597504711Z"}
{"log":" method=GET,\n","stream":"stdout","time":"2024-08-13T06:00:03.597534481Z"}
{"log":" URI=/login/callback,\n","stream":"stdout","time":"2024-08-13T06:00:03.597538999Z"}
{"log":" contentType=null,\n","stream":"stdout","time":"2024-08-13T06:00:03.597542346Z"}
{"log":" remoteAddr=31.223.184.119,\n","stream":"stdout","time":"2024-08-13T06:00:03.597545548Z"}

........

{"log":"[ERROR]-[2024-08-13 14:01:32]-[org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer:104]: Renders template [error/401.ftl] failed [Request [\n","stream":"stdout","time":"2024-08-13T06:01:32.22028128Z"}
{"log":" method=GET,\n","stream":"stdout","time":"2024-08-13T06:01:32.220293765Z"}
{"log":" URI=/login/callback,\n","stream":"stdout","time":"2024-08-13T06:01:32.220297245Z"}
{"log":" contentType=null,\n","stream":"stdout","time":"2024-08-13T06:01:32.220300265Z"}
{"log":" remoteAddr=31.223.184.119,\n","stream":"stdout","time":"2024-08-13T06:01:32.220303247Z"}
{"log":" headers=[\n","stream":"stdout","time":"2024-08-13T06:01:32.220306247Z"}

........

nginx 文件配置如下

upstream backend {
    server localhost:8080; # Solo 监听端口
}

server {
    listen 80;
    server_name blog.wxxpersonal.top;

    #root /var/blog;
    #index index.html index.htm;

    #location / {
    #    try_files $uri $uri/ =404;
    #}

    # Optional: Add logging
    access_log /var/log/nginx/blog.access.log;
    error_log /var/log/nginx/blog.error.log;

    location / {
        proxy_pass http://backend$request_uri;
        proxy_set_header  Host $http_host;
        proxy_set_header  X-Real-IP $remote_addr;
	client_max_body_size  10m;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header X-Forwarded-Proto $scheme;
	#proxy_intercept_errors on;
        #error_page 301 302 307 = @handle_redirects;
    }

    #location @handle_redirects {
    #    set $saved_redirect_location '$upstream_http_location';
    #    # 解决cookie跨域问题
    #    proxy_set_header Cookie $http_cookie;
    #    proxy_pass $saved_redirect_location;
    #}


}

nginx blog.error.log 如下

2024/08/13 01:41:42 [error] 1888416#1888416: *76 no resolver defined to resolve localhost, client: 91.199.84.158, server: blog.wxxpersonal.top, request: "GET /favicon.ico HTTP/1.1", host: "blog.wxxpersonal.top", referrer: "http://blog.wxxpersonal.top/"
2024/08/13 02:33:53 [error] 1927942#1927942: *128 no resolver defined to resolve ld246.com while sending to client, client: 91.199.84.158, server: blog.wxxpersonal.top, request: "GET /login/redirect?referer=http%3A%2F%2Fblog.wxxpersonal.top HTTP/1.1", host: "blog.wxxpersonal.top", referrer: "http://blog.wxxpersonal.top/"

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...