halo-dev / plugin-sitemap

Halo 2.0 的站点 Sitemap 生成插件
https://halo.run/store/apps/app-QDFMI
GNU General Public License v3.0
6 stars 6 forks source link

访问站点地图为404,为啥找不到了 #29

Closed Jehol1983 closed 12 months ago

Jehol1983 commented 1 year ago

https://rehe.tech/sitemap.xml

ruibaby commented 1 year ago

这是 Nginx 的 404,建议先检查 Nginx 配置。

Jehol1983 commented 1 year ago

解决不了,不知道哪里错了,,,哎

ruibaby commented 1 year ago

解决不了,不知道哪里错了,,,哎

可以提供一下你的 Nginx 配置。

Jehol1983 commented 1 year ago
server {
    listen 80 ; 
    listen 443 ssl http2 ; 
    listen [::]:443 ssl http2 ; 
    listen [::]:80 ; 
    charset utf-8; 
    server_name rehe.tech; 
    index index.php index.html index.htm; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    access_log /www/sites/rehe/log/access.log; 
    error_log /www/sites/rehe/log/error.log; 
    access_by_lua_file /www/common/waf/access.lua; 
    set $RulePath /www/sites/rehe/waf/rules; 
    set $logdir /www/sites/rehe/log; 
    set $redirect on; 
    set $attackLog on; 
    set $CCDeny on; 
    set $urlWhiteAllow off; 
    set $urlBlockDeny off; 
    set $argsDeny off; 
    set $postDeny off; 
    set $cookieDeny off; 
    set $fileExtDeny off; 
    set $ipBlockDeny off; 
    set $ipWhiteAllow off; 

    location ~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    location /intro {
        alias /usr/share/nginx/html_index/intro/; 
    }
    location /site {
        alias /usr/share/nginx/html_index/site/; 
    }
    location /game {
        alias /usr/share/nginx/html_index/game/; 
    }
    location / {
        proxy_pass "http://127.0.0.1:8080"; 
    }
    location /lover/ {
        proxy_pass http://127.0.0.1:8081; 
        proxy_set_header Host $host; 
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_set_header X-Original-URI $request_uri; 
        rewrite ^/lover/(.*) /$1 break; 
    }
    location /comm/ {
        proxy_pass http://127.0.0.1:8360; 
        proxy_set_header Host $host; 
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_set_header X-Original-URI $request_uri; 
        proxy_set_header X-Forwarded-Proto $scheme; 
        # 支持重定向
        proxy_redirect http://$host/comm/ http://$host/comm/; 
        # 远程服务器可能返回重定向响应,需要设置代理缓冲区
        proxy_buffering off; 
        rewrite ^/comm/(.*)$ /$1 break; 
    }

    if ($scheme = http) {
        return 301 https://$host$request_uri; 
    }
    ssl_certificate /www/sites/rehe/ssl/fullchain.pem; 
    ssl_certificate_key /www/sites/rehe/ssl/privkey.pem; 
    ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1 TLSv1; 
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; 
    ssl_prefer_server_ciphers on; 
    ssl_session_cache shared:SSL:10m; 
    ssl_session_timeout 10m; 
    add_header Strict-Transport-Security "max-age=31536000"; 
    error_page 497 https://$host$request_uri; 
    proxy_set_header X-Forwarded-Proto https; 
    ssl_stapling on; 
    ssl_stapling_verify on; 
}
JohnNiang commented 12 months ago

Hi @Jehol1983 ,建议先检查以下几点后,再反馈一下:

  1. 确认一下是否安装 Sitemap 插件
  2. 确认一下该插件状态是否正常。
  3. 如果不正常,建议升级到最新后重试。
Jehol1983 commented 12 months ago

https://blog.rehe.tech/sitemap.xml 还是不行,插件最新的,也重新装了,还是不行,rss可以正常访问

guqing commented 12 months ago

server {

    location /site {

        alias /usr/share/nginx/html_index/site/; 

    }

此问题与 halo 无关,你自己配置的 nginx 前缀匹配规则 /site 拦截了请求所以 sitemap无法访问,比如你访问 https://blog.rehe.tech/sit 提示找不到是 halo 的页面,而 https://blog.rehe.tech/sitem 提示404是nginx的页面

guqing commented 12 months ago

/kind support

Jehol1983 commented 12 months ago
server {

    location /site {

        alias /usr/share/nginx/html_index/site/; 

    }

此问题与 halo 无关,你自己配置的 nginx 前缀匹配规则 /site 拦截了请求所以 sitemap无法访问,比如你访问 https://blog.rehe.tech/sit 提示找不到是 halo 的页面,而 https://blog.rehe.tech/sitem 提示404是nginx的页面

哈哈,没想到这个,解决了,感谢感谢