Open zrbiao opened 1 month ago
Hi, I cannot replicate this issue, nor have I seen anyone experience this before.
Firstly, does the file modules/Core/pages/api/v2/index.php
exist?
https://www.scavengertown.top/index.php?route=/api/v2 Domain normal access
file modules/Core/pages/api/v2/index.php
exist
The file has not been modified
<?php /*
*/
// Headers header('Content-Type: application/json; charset=UTF-8');
$page_title = 'api'; require_once(ROOT_PATH . '/core/templates/frontend_init.php');
// Load modules + template Module::loadPage($user, $pages, $cache, $smarty, [$navigation, $cc_nav, $staffcp_nav], $widgets, $template);
// Initialise $api = new Nameless2API($route, $language, $endpoints);
Is the hostname
set correctly in the file core/config.php
? The hostname
should be www.scavengertown.top
in this case.
'hostname' => 'www.scavengertown.top',
That's right
have a question The first base URL appears when the database is installed Not www.scavengertown.top, but another domain name I changed to www.scavengertown.top Normal access
I tried to reinstall the new database using dist 2.1.2 version The first time you enter the background immediately open the API or 404
I suspect it's my system!
我怀疑我的系统有问题但又不知道问题出在哪里! 我配合排除问题解决,需要什么信息我可以提供。 I suspect something is wrong with my system but I don't know what the problem is! I will help solve the problem. I can provide any information I need.
Does your nginx config have the location blocks from the example? https://github.com/NamelessMC/Nameless/blob/develop/nginx.example
server
{
listen 888;
server_name phpmyadmin;
index index.html index.htm index.php;
root /www/server/phpmyadmin;
allow 127.0.0.1;
allow ::1;
deny all;
location ~ /tmp/ {
return 403;
}
# Friendly URL support
location / {
try_files $uri $uri/ /index.php?route=$uri&$args;
}
# Deny access to some file types and directories
location ~ \.(tpl|cache|htaccess)$ {
return 403;
}
location ^~ /node_modules/ {
return 403;
}
location ^~ /scripts/ {
return 403;
}
add_header X-Frame-Options "SAMEORIGIN";
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log /www/wwwlogs/access.log;
}
include /www/server/panel/vhost/nginx/*.conf;
}
重启nginx 重启服务器 Restart nginx Restart the server 404 nginx日志没有报错 No errors are reported in the log
192.168.0.199 - - [13/Jul/2024:19:34:54 +0800] "GET /index.php?route=/api/v2 HTTP/1.1" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 127.0.0.1 - - [13/Jul/2024:19:35:00 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 192.168.0.199 - - [13/Jul/2024:19:35:29 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 192.168.0.199 - - [13/Jul/2024:19:35:30 +0800] "GET /favicon.ico HTTP/2.0" 404 548 "https://192.168.0.198/index.php?route=/api/v2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 192.168.0.199 - - [13/Jul/2024:19:35:51 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 192.168.0.199 - - [13/Jul/2024:19:35:52 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 192.168.0.199 - - [13/Jul/2024:19:35:53 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
2024/07/16 08:42:32 [error] 50103#0: 11 open() "/home/www/wwwroot/mt102ifb/404.html" failed (2: No such file or directory), client: 192.168.0.199, server: scavengertown.abc6.net, request: "GET /index.php?route=/api/v2 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-81.sock", host: "192.168.0.198" 2024/07/16 08:42:33 [error] 50103#0: 11 open() "/home/www/wwwroot/mt102ifb/404.html" failed (2: No such file or directory), client: 192.168.0.199, server: scavengertown.abc6.net, request: "GET /index.php?route=/api/v2 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-81.sock", host: "192.168.0.198" 2024/07/16 08:45:07 [error] 50105#0: 97 open() "/home/www/wwwroot/mt102ifb/404.html" failed (2: No such file or directory), client: 192.168.0.198, server: scavengertown.abc6.net, request: "GET /index.php?route=/api/v2 HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-cgi-81.sock", host: "www.scavengertown.top" 2024/07/16 08:57:58 [error] 50103#0: 225 open() "/home/www/wwwroot/mt102ifb/favicon.ico" failed (2: No such file or directory), client: 192.168.0.198, server: scavengertown.abc6.net, request: "GET /favicon.ico HTTP/1.1", host: "scavengertown.top" 2024/07/16 08:57:58 [error] 50103#0: 225 open() "/home/www/wwwroot/mt102ifb/404.html" failed (2: No such file or directory), client: 192.168.0.198, server: scavengertown.abc6.net, request: "GET /favicon.ico HTTP/1.1", host: "scavengertown.top" 2024/07/16 09:14:25 [error] 51831#0: 415 open() "/home/www/wwwroot/mt102ifb/404.html" failed (2: No such file or directory), client: 192.168.0.198, server: scavengertown.abc6.net, request: "GET /index.php?route=/api/v2 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-81.sock", host: "www.scavengertown.top"
server { listen 888; server_name phpmyadmin; index index.html index.htm index.php; root /www/server/phpmyadmin; allow 127.0.0.1; allow ::1; deny all; location ~ /tmp/ { return 403; } # Friendly URL support location / { try_files $uri $uri/ /index.php?route=$uri&$args; } # Deny access to some file types and directories location ~ \.(tpl|cache|htaccess)$ { return 403; } location ^~ /node_modules/ { return 403; } location ^~ /scripts/ { return 403; } add_header X-Frame-Options "SAMEORIGIN"; #error_page 404 /404.html; include enable-php.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /\. { deny all; } access_log /www/wwwlogs/access.log; } include /www/server/panel/vhost/nginx/*.conf; }
重启nginx 重启服务器 Restart nginx Restart the server 404 nginx日志没有报错 No errors are reported in the log
This appears to be your configuration for phpMyAdmin and not Nameless. Do you have other nginx website configs?
网站配置 Web configuration
server
{
listen 80 default_server;
listen 443 ssl default_server;
listen 443 quic default_server;
listen [::]:443 ssl default_server;
listen [::]:443 quic default_server;
http2 on;
server_name scavengertown.abc6.net www.scavengertown.top;
index index.php index.html index.htm default.php default.htm default.html;
root /home/www/wwwroot/mt102ifb;
#CERT-APPLY-CHECK--START
# 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
include /www/server/panel/vhost/nginx/well-known/www.scavengertown.top.conf;
#CERT-APPLY-CHECK--END
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/www.scavengertown.top/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/www.scavengertown.top/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
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";
add_header Alt-Svc 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"';
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
#TOMCAT-START
location /
{
proxy_pass "http://www.scavengertown.top:8080";
proxy_set_header Host www.scavengertown.top;
proxy_set_header X-Forwarded-For $remote_addr;
}
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
expires 12h;
}
location ~ .*\.war$
{
return 404;
}
#TOMCAT-END
#SECURITY-START 防盗链配置
location ~ .*\.(jpg|jpeg|gif|png|js|css)$
{
expires 30d;
access_log /dev/null;
valid_referers scavengertown.abc6.net www.scavengertown.top;
if ($invalid_referer){
return 404;
}
}
#SECURITY-END
include enable-php-81.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/www.scavengertown.top.conf;
#REWRITE-END
# Friendly URL support
location / {
try_files $uri $uri/ /index.php?route=$uri&$args;
}
# Deny access to some file types and directories
location ~ \.(tpl|cache|htaccess)$ {
return 403;
}
location ^~ /node_modules/ {
return 403;
}
location ^~ /scripts/ {
return 403;
}
add_header X-Frame-Options "SAMEORIGIN";
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
#禁止在证书验证目录放入敏感文件
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
return 403;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log /dev/null;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log /dev/null;
}
access_log /www/wwwlogs/www.scavengertown.top.log;
error_log /www/wwwlogs/www.scavengertown.top.error.log;
}
`192.168.0.199 - - [18/Jul/2024:05:04:58 +0800] "GET /panel/core/api/ HTTP/1.1" 200 7420 "http://192.168.0.198/panel/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
192.168.0.198 - - [18/Jul/2024:05:05:05 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
192.168.0.198 - - [18/Jul/2024:05:05:12 +0800] "GET /favicon.ico HTTP/2.0" 404 548 "https://www.scavengertown.top/index.php?route=/api/v2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
192.168.0.198 - - [18/Jul/2024:05:07:13 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
192.168.0.198 - - [18/Jul/2024:05:08:26 +0800] "GET /index.php?route=/api/v2 HTTP/2.0" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"`
192.168.0.198 cento9 192.168.0.199 windows
Sorry for the delay.
Your nginx configuration is very complex, could you try renaming this configuration file to something else in order to temporarily disable it, and try the default Nameless nginx configuration as per https://github.com/NamelessMC/Nameless/blob/develop/nginx.example
This should help us to understand where the problem is, it might lie with some of the custom rules that have been added in.
全部系统重新重置默认已正常 All systems are reset to normal by default
Describe the issue
API link http://192.168.0.198/index.php?route=/api/v2 404 Not Found
Database brand new nameless-deps-dev 2.1.2 CentOS Stream 9 x86_64(Py3.7.16) minimum Access registration normal PHP GD 8.1.28 √ PHP mbstring 8.1.28√ PHP PDO 8.1.28√ PHP cURL 8.1.28√ PHP XML 8.1.28√ PHP EXIF 8.1.28√ PHP PDO 8.1.28√ PHP PDO MySQL 8.1.28√ MySQL Server 8.0.36√
NamelessMC Version
< 2.1.0
To Reproduce
1.Clean Install 2.Enter the background and directly enable the api 3.404
Expected Behaviour
No response
Screenshots
No response
Additional Information
No response