我在讓我的 React 應用程序在遠程服務器上運行時遇到問題。我有 Nginx 設置如下confserver { listen 80; listen [::]:80; server_name xxx.xxx.x.x; root /var/www/my-site; index index.html; gzip on; gzip_comp_level 3; gzip_types text/plain text/css application/javascript image/*;}為了確認 Nginx 的工作原理,我輸入了一個index.html,/var/www/my-site它確實有效并且沒有問題。然后我cd從/var/www/my-sitegit 克隆反應項目。然后我跑npm run build。我不確定接下來要做什么。我試過了serve -s build,我得到:ERROR: Cannot copy to clipboard: write EPIPE ┌──────────────────────────────────────────────────┐ │ │ │ Serving! │ │ │ │ - Local: http://localhost:5000 │ │ - On Your Network: http://xxx.xxx.xx.x:5000 │ │ │ └──────────────────────────────────────────────────┘但是,當我將瀏覽器指向服務器地址時,我什么也得不到(我刪除了原始的 index.html)。我在這里做錯了什么?
在靜態 Nginx 服務器上部署 React 應用程序時遇到問題
慕村9548890
2023-03-18 11:23:59