配置1
server{listen 80;server_name www.gejialun.vip;index index.html;error_log /www/wwwlogs/nginx/error.log;access_log /www/wwwlogs/nginx/access.log;location / {root /www/wwwroot/web_site/build; # 网站根目录index index.html; # 默认首页文件try_files $uri $uri/ /index;}# location /vite2-vue3-jsx {# alias /www/wwwroot/vite2-vue3-jsx; # 网站根目录# index index.html; # 默认首页文件# try_files $uri $uri/ /index;# }# location /vite2-react17 {# alias /www/wwwroot/vite2-react17; # 网站根目录# index index.html; # 默认首页文件# try_files $uri $uri/ /index;# }}
配置2
server {listen 80;server_name reactchart.gejialun.vip;location / {root /www/wwwroot/react-chart; # 项目打包后的文件夹index index.html index.htm;try_files $uri $uri/ /index.html @rewrites;expires -1; # 首页一般没有强制缓存add_header Cache-Control no-cache;}location @rewrites {rewrite ^(.+)$ /index.html break;}}
