如何在一个域中设置两个应用程序 NGINX?

我有两个应用。

  • 登陆页面 (Nuxt.js)
  • 主要应用(Laravel Vue)

我在设置 NGINX 时遇到问题。每次进入LaravelVue Apps,总是找不到资源,因为它总是在nuxtjs中访问root。

如何配置?

我的 nginx 看起来像这样

server {

        server_name mydomain.com;

        #nuxt
        location / {
                root /var/www/html/nuxt;

                proxy_pass http://localhost:8006;
                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;
        }

        #laravel&vue
        location /client {
                root /var/www/html/laravue/public;

                # First attempt to serve request as file,then
                # as directory,then fall back to displaying a 404.
                #try_files $uri $uri/ /index.php?$query_string;

        }

        location /dashboard {
                root /var/www/html/laravue/public;

                # First attempt to serve request as file,then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {
                 root /var/www/html/laravue/public;

                 try_files $uri =404;
                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
                 fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                 fastcgi_index index.php;
                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                 include fastcgi_params;
         }


}

谢谢

emheiyan 回答:如何在一个域中设置两个应用程序 NGINX?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/1275977.html

大家都在问