Tôi đã đặt một thư mục mặc định cho nginx
để tìm các tệp, nhưng khi tôi cố truy cập vào một vị trí nginx nhất định, chẳng hạn như /
tìm thư mục gốc mặc định /var/www/html/LiveStream/LiveStream-backend
thay vì những gì tôi đã chỉ định trong khối vị trí /var/www/html/LiveStream/LiveStream-frontend/users/build
để biết thêm chi tiết tập tin cấu hình nginx của tôi
log_format upstreamlog '$server_name to : $upstream_addr [$request]'
'upstream_response_time $upstream_response_time'
'msec $msec thời gian yêu cầu $request_time';
ngược dòng load_balance{
ip_hash;
máy chủ cục bộ:3016;
}
người phục vụ {
nghe 443 ssl;
ssl_certificate /etc/letsencrypt/live/ethiolive.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ethiolive.net/privkey.pem;
bao gồm /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Yêu cầu nâng cấp chính sách bảo mật nội dung-không an toàn;
gốc /var/www/html/LiveStream/LiveStream-backend;
tên_máy chủ ethiolive.net www.ethiolive.net;
vị trí /api/ {
gốc /var/www/html/LiveStream/LiveStream-backend;
proxy_pass http://load_balance;
proxy_http_version 1.1;
proxy_set_header Nâng cấp $http_upgrade;
'nâng cấp' kết nối proxy_set_header;
proxy_set_header Máy chủ lưu trữ $host;
proxy_ssl_server_name bật;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 3600;
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
proxy_set_header Nâng cấp chính sách bảo mật-nội dung-yêu cầu không an toàn;
}
địa điểm / {
gốc /var/www/html/LiveStream/LiveStream-frontend/users/build;
chỉ mục index.html index.htm;
try_files $uri /index.html;
}
vị trí / quản trị viên {
bí danh /var/www/html/LiveStream/LiveStream-frontend/admin/build/;
chỉ mục index.html index.htm;
try_files $uri $uri/ /index.html;
}
vị trí /socket/ {
proxy_pass http://load_balance/socket.io/;
proxy_redirect tắt;
proxy_http_version 1.1;
proxy_set_header Nâng cấp $http_upgrade;
proxy_set_header Kết nối "nâng cấp";
proxy_set_header Máy chủ lưu trữ $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
bật proxy_set_header X-Forwarded-Ssl;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
}
vị trí /socket.io/{
proxy_pass http://load_balance/socket.io/;
proxy_set_header Nâng cấp $http_upgrade;
proxy_set_header Kết nối "nâng cấp";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Máy chủ lưu trữ $host;
bật proxy_set_header X-Forwarded-Ssl;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
}
}