nginx 网站后缀斜杠

我在本地npm run dev环境测试,网站url后缀没有斜杠。
但是在npm run build后把网站放1panel 的静态网站上面后,网站url却有后缀斜杠。这是为什么,我想实现:我不要网站url后缀有斜杠。

这是我服务器上面的nginx openresty网站配置:

server {
    listen 80 ; 
    listen 443 ssl http2 ; 
    server_name abc.com; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection $http_connection; 
    access_log /www/sites/abc.com/log/access.log main; 
    error_log /www/sites/abc.com/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    root /www/sites/abc.com/index; 
    error_page 404 /404.html; 
    include /www/sites/abc.com/redirect/*.conf; 
    if ($scheme = http) {
        return 301 https://$host$request_uri; 
    }
    ssl_certificate /www/sites/abc.com/ssl/fullchain.pem; 
    ssl_certificate_key /www/sites/abc.com/ssl/privkey.pem; 
    ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1 TLSv1; 
    ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DSS:!DES:!RC4:!3DES:!MD5:!PSK:!KRB5:!SRP:!CAMELLIA:!SEED; 
    ssl_prefer_server_ciphers on; 
    ssl_session_cache shared:SSL:10m; 
    ssl_session_timeout 10m; 
    error_page 497 https://$host$request_uri; 
    proxy_set_header X-Forwarded-Proto https; 
    add_header Strict-Transport-Security "max-age=31536000"; 
}

配置文件

user root; 
worker_processes auto; 
error_log /var/log/nginx/error.log notice; 
error_log /dev/stdout notice; 
pid /var/run/nginx.pid; 
events {
    worker_connections 1024; 
}
http {
    include mime.types; 
    default_type application/octet-stream; 
    log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; 
    server_tokens off; 
    access_log /var/log/nginx/access.log main; 
    access_log /dev/stdout main; 
    sendfile on; 
    server_names_hash_bucket_size 512; 
    client_header_buffer_size 32k; 
    client_max_body_size 1024m; 
    keepalive_timeout 3600; 
    keepalive_requests 100000; 
    gzip on; 
    gzip_min_length 1k; 
    gzip_buffers 4 16k; 
    gzip_http_version 1.1; 
    gzip_comp_level 5; 
    gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml; 
    gzip_vary on; 
    gzip_proxied expired no-cache no-store private auth; 
    gzip_disable "MSIE [1-6]\."; 
    limit_conn_zone $binary_remote_addr zone=perip:10m; 
    limit_conn_zone $server_name zone=perserver:10m; 
    include /usr/local/openresty/nginx/conf/conf.d/*.conf; 
    include /usr/local/openresty/1pwaf/data/conf/waf.conf;
    proxy_temp_path /www/common/proxy/proxy_temp_dir; 
    proxy_cache_path /www/common/proxy/proxy_cache_dir levels=1:2 keys_zone=proxy_cache_panel:20m inactive=1d max_size=5g; 
    client_body_buffer_size 512k; 
    proxy_connect_timeout 60; 
    proxy_read_timeout 60; 
    proxy_send_timeout 60; 
    proxy_buffer_size 32k; 
    proxy_buffers 4 64k; 
    proxy_busy_buffers_size 128k; 
    proxy_temp_file_write_size 128k; 
    proxy_next_upstream error timeout invalid_header http_500 http_503 http_404; 
    proxy_cache proxy_cache_panel; 
}

反向代理配置看一下

请问我应该点击哪里,可以把反代的配置发给你看?请指导。

如果你没有反代 你是怎么把域名跟你的 npm 启动的应用关联的呢

问题你这也不影响项目正常访问,不要强迫症啦

新建静态网站,代码加进去,就可以启动网站了

那有可能跟你代码有关

谢谢。我检查下