Сгенерированные NUXT подстраницы просто загружаются при доступе - PullRequest
0 голосов
/ 02 апреля 2019

У меня возникли некоторые проблемы с тем, как правильно запустить мое приложение nuxt на NGINX.Итак, у меня есть приложение NUXT, использующее универсальный режим с 2 страницами index и user . Я генерирую страницы с помощью команды npm run generate .В сгенерированном каталоге dist есть index.html и /user/index.html.

Моя проблема в том, что страница пользователя просто загружается, когда я пытаюсь получить к ней доступ, и не останавливается, когда я пытаюсь получить доступ * 1011.* nuxt-template.loc / user , но страница индекса работает нормально и загружает ожидаемое содержимое.

Версия NUXT и Vue JS

nuxt - ^2.5.1

vue - ^ 2.6.10

Ниже моя конфигурация NGINX

server {
    listen 80;

    root /web/nuxt-template/dist;
    server_name nuxt-template.loc;

    location / {
        try_files $uri $uri/ /index.html;
    }
}

NUXT config

const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
const pkg = require('./package')

module.exports = {
    mode: 'universal',

    /*
    ** Headers of the page
    */
    head: {
        title: pkg.name,
        meta: [
            { charset: 'utf-8' },
            { name: 'viewport', content: 'width=device-width, initial-scale=1' },
            { hid: 'description', name: 'description', content: pkg.description }
        ],
        link: [
            { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
            {
                rel: 'stylesheet',
                href: 'https://fonts.googleapis.com/css?family=Lato|Montserrat|Open+Sans|Material+Icons'
            }
        ]
    },

    /*
    ** Customize the progress-bar color
    */
    loading: { color: '#fff' },

    /*
    ** Global CSS
    */
    css: ['~/assets/style/app.styl'],

    /*
    ** Plugins to load before mounting the App
    */
    plugins: [
        '@/plugins/vuex',
        '@/plugins/vuetify',
        '@/plugins/vue-filters',
        '@/plugins/vue-methods'
    ],

    /*
    ** Nuxt.js modules
    */
    modules: [
        // Doc: https://axios.nuxtjs.org/usage
        '@nuxtjs/axios',
        '@nuxtjs/pwa'
    ],
    /*
    ** Axios module configuration
    */
    axios: {
    // See https://github.com/nuxt-community/axios-module#options
    },

    /*
    ** Build configuration
    */
    build: {
        transpile: ['vuetify/lib'],
        plugins: [new VuetifyLoaderPlugin()],
        loaders: {
            stylus: {
                import: ['~assets/style/variables.styl']
            }
        },

        /*
        ** You can extend webpack config here
        */
        extend(config, ctx) {
            // Run ESLint on save
            if (ctx.isDev && ctx.isClient) {
                /*config.module.rules.push({
                    enforce: 'pre',
                    test: /\.(js|vue)$/,
                    loader: 'eslint-loader',
                    exclude: /(node_modules)/
                })*/
            }
        }
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...