Hiddify-Manager icon indicating copy to clipboard operation
Hiddify-Manager copied to clipboard

حل شدن مشکل nginx در نسخه 1010.8.7

Open nima2010 opened this issue 1 year ago • 2 comments

دوستان برای مشکل گیر کردن nginx روی حالت activating من این مراحل رو با کمک chatGPT رفتم و تونستم درستش کنم، شما هم با مسئولیت خودتون شاید بتونید مشکل رو حل کنید طبق مراحلی که من رفتم: توضیح chatGPT از مشکل من این بود: The issue arises from the use of the http2 directive in the configuration file. The directive http2 on; is incorrect because HTTP/2 is typically enabled in the listen directive rather than as a standalone setting.

sudo nano /opt/hiddify-manager/nginx/conf.d/singbox-base.conf

مشکل از فایل کانفیگ singbox بود برای من که با با پاک کردن http2 on در فایل کانفیگ و ریست کردن سرویس ها درست شد:

server { listen unix:/opt/hiddify-manager/nginx/run/grpc-singbox.sock proxy_protocol; # Removed 'http2 on;' as it is not valid here

set_real_ip_from unix:;
real_ip_header proxy_protocol;

location /hse9MweLFzp2myIx3accz {
    include /opt/hiddify-manager/nginx/parts/grpc.conf;
    grpc_pass 127.0.0.1:2023;
}
location /WebfhEhsQt3gQ86yIx3accz {
    include /opt/hiddify-manager/nginx/parts/grpc.conf;
    grpc_pass 127.0.0.1:2033;
}
location /uwmzVAfVwrTRvHMyIx3accz {
    include /opt/hiddify-manager/nginx/parts/grpc.conf;
    grpc_pass unix:/opt/hiddify-manager/xray/run/ssg.sock;
}
location /7aK5upNZoAUyyIx3accz {
    include /opt/hiddify-manager/nginx/parts/grpc.conf;
    grpc_pass 127.0.0.1:2013;
}
include /opt/hiddify-manager/nginx/parts/hiddify.conf;

}

آخرش هم اینو زدم:

sudo systemctl reload hiddify-nginx.service

sudo systemctl restart hiddify-nginx.service

nima2010 avatar Dec 17 '24 10:12 nima2010

مشکل من به این صورت بود: root@ger2:/opt/hiddify-manager# sudo journalctl -u hiddify-nginx --no-pager -n 50 Dec 17 14:05:43 ger2 systemd[1]: Failed to start hiddify-nginx - high performance web server. Dec 17 14:05:46 ger2 systemd[1]: hiddify-nginx.service: Scheduled restart job, restart counter is at 5. Dec 17 14:05:46 ger2 systemd[1]: Stopped hiddify-nginx - high performance web server. Dec 17 14:05:46 ger2 systemd[1]: Starting hiddify-nginx - high performance web server... Dec 17 14:05:46 ger2 nginx[1301]: nginx: [emerg] unknown directive "http2" in /opt/hiddify-manager/nginx/conf.d/xray-base.conf:16 Dec 17 14:05:46 ger2 systemd[1]: hiddify-nginx.service: Control process exited, code=exited, status=1/FAILURE Dec 17 14:05:46 ger2 systemd[1]: hiddify-nginx.service: Failed with result 'exit-code'. Dec 17 14:05:46 ger2 systemd[1]: Failed to start hiddify-nginx - high performance web server. Dec 17 14:05:49 ger2 systemd[1]: hiddify-nginx.service: Scheduled restart job, restart counter is at 6. Dec 17 14:05:49 ger2 systemd[1]: Stopped hiddify-nginx - high performance web server. Dec 17 14:05:49 ger2 systemd[1]: Starting hiddify-nginx - high performance web server... Dec 17 14:05:49 ger2 nginx[1425]: nginx: [emerg] unknown directive "http2" in /opt/hiddify-manager/nginx/conf.d/xray-base.conf:16 که با chatgpt با این دستورات حل شد. The error unknown directive "http2" suggests that the nginx binary being used does not support the HTTP/2 protocol, which is required by the configuration file /opt/hiddify-manager/nginx/conf.d/xray-base.conf. Here’s how you can resolve this:

Steps to Fix

  1. Verify Installed Nginx Version Check the installed version and compilation options to ensure it supports HTTP/2:

nginx -V

Look for the --with-http_v2_module flag in the output. If it's missing, your current nginx installation does not support HTTP/2.

2. Install a Compatible Nginx Version If HTTP/2 is not supported, you need to install a compatible version:

Update Nginx to a compatible version:

Add the official Nginx repository to your system:

sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/nginx sudo apt update

Install Nginx with HTTP/2 support:

sudo apt install nginx

ErtebateWeb avatar Dec 17 '24 10:12 ErtebateWeb

تشکر از راهکارتون

litoosh13 avatar Dec 18 '24 13:12 litoosh13