Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nginx+;Nuxt网站未重定向到404_Nginx_Nuxt.js - Fatal编程技术网

Nginx+;Nuxt网站未重定向到404

Nginx+;Nuxt网站未重定向到404,nginx,nuxt.js,Nginx,Nuxt.js,我有一个使用Laravel+Nuxt开发的网站。我正在使用Nginx来运行该网站。在numxt generate+numxt start上,我被重定向到404,但在实时网站上,我得到了infinte加载:。在配置文件中玩了很多,并检查了堆栈上的其他答案,没有任何帮助:( 这是我的nginx配置: map $sent_http_content_type $expires { default on; text

我有一个使用Laravel+Nuxt开发的网站。我正在使用Nginx来运行该网站。在
numxt generate
+
numxt start
上,我被重定向到404,但在实时网站上,我得到了infinte加载:。在配置文件中玩了很多,并检查了堆栈上的其他答案,没有任何帮助:(

这是我的nginx配置:

 map $sent_http_content_type $expires {
               default                       on;
        text/html                  epoch;
        text/css                   max;
        application/javascript     max;
        ~image/                    max;
    }
        
 server {
        # redirect all HTTP to HTTPS
        listen 80;
        expires $expires;
        index index.php index.html;
        server_name flowerqueen.ro www.flowerqueen.ro;
        
        return 301 https://flowerqueen.ro$request_uri;
      }
        
        
server {
        listen 443 ssl;
        
        server_name flowerqueen.ro www.flowerqueen.ro;
        
        #ssl    on;
        ssl_certificate    /etc/ssl/certificate.crt;
        ssl_certificate_key    /etc/ssl/private.key;
        
        index index.php index.html;
        error_page 404 /404.html;
        # expires $expires;
        
        
        
        location / {
        proxy_pass http://localhost:4000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_cache cache;
        proxy_cache_key $host$uri$is_args$args;
        proxy_cache_valid 200 301 302 12h;
        #               try_files $uri $uri/ /404.html;
        #        add_header X-Proxy-Cache $upstream_cache_status;
        }
        location ^~ /images {
        proxy_cache cache;
        proxy_cache_valid 200 301 302 12h;
   }
        
}
Nuxt:


终于解决了这个问题,谷歌现在会很高兴的。 问题就在这里:

  generate: {
     fallback: '404.html',
我把页面
404.vue
放在
/pages
目录下,但这不起作用

404.vue
更改并移动到
404/index.vue
并将配置更改为:

  generate: {
       fallback: '404/index.html',
为我解决了这个问题

我还删除了404页面上所有不必要的代码

谢谢大家的帮助:)

  generate: {
       fallback: '404/index.html',