xiaomlove / nexusphp

A private tracker application base on NexusPHP
https://nexusphp.org
GNU General Public License v2.0
892 stars 180 forks source link

[Request] Tracker 地址建议使用旧的 announce.php #105

Closed Skyline-007 closed 2 years ago

Skyline-007 commented 2 years ago

Hello

I tried to understand your tutorial but google translate does not translate it well for me.

Here is the link : https://nexusphp.org/2022/07/18/tracker-url-recommend-to-use-old-announce-php/

Can you be more specific on the tutorial what it is for ?

I don't understand where to make the changes can you tell me which file to change ?

location ^~ /api/announce { rewrite /api/announce(.*) /announce.php$1 last; }

location ^~ /api/scrape { rewrite /api/scrape(.*) /scrape.php$1 last; }

Do you need to add the lines in the configure the web server file ? ( https://doc.nexusphp.org/en/installation.html#configure-the-web-server )

server {

# whichever is more appropriate
root /RUN_PATH; 

server_name DOMAIN;

location / {
    index index.html index.php;
    try_files $uri $uri/ /nexus.php$is_args$args;
}

# Filament
location ^~ /filament {
    try_files $uri $uri/ /nexus.php$is_args$args;
}

location ~ \.php {
    # whichever is true
    fastcgi_pass 127.0.0.1:9000; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

access_log /var/log/nginx/DOMAIN.access.log;
error_log /var/log/nginx/DOMAIN.error.log;

}

Or is it another file to edit ?

Thank you in advance for your answer

Best regards

Skyline-007

xiaomlove commented 2 years ago

add to the config file, just like this:

# whichever is more appropriate
root /RUN_PATH; 

server_name DOMAIN;

location / {
    index index.html index.php;
    try_files $uri $uri/ /nexus.php$is_args$args;
}

# Filament
location ^~ /filament {
    try_files $uri $uri/ /nexus.php$is_args$args;
}
location ^~ /api/announce {
    rewrite /api/announce(.*) /announce.php$1 last;
}

location ^~ /api/scrape {
    rewrite /api/scrape(.*) /scrape.php$1 last;
}

location ~ \.php {
    # whichever is true
    fastcgi_pass 127.0.0.1:9000; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

access_log /var/log/nginx/DOMAIN.access.log;
error_log /var/log/nginx/DOMAIN.error.log;
Skyline-007 commented 2 years ago

@xiaomlove Thank you for your reply.

And thank you for telling me where to put the lines.

But what exactly is this addition of lines for ?

xiaomlove commented 2 years ago

/api/announce does not perform as well as /announce.php, this is to forward requests from /api/announce to /announce.php to come in and respond.

Skyline-007 commented 2 years ago

Ok

Thank you for your reply