laravel - 如何在一个域 NGINX 中设置两个应用程序?
问题描述
我有两个应用程序。
- 登陆页面 (Nuxt.js)
- 主要应用程序(Laravel Vue)
我在设置 NGINX 时遇到问题。每次我进入 LaravelVue 应用程序时,总是找不到资产,因为它总是在 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
# as directory, 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;
}
}
谢谢
解决方案
推荐阅读
- javascript - csrf_token() 不会被令牌值替换在与 laravel 的反应中
- alexa - Alexa Skill:如何播放 mp3 超过 4 分钟
- php - 改进图片上传脚本
- intellij-idea - 将 Lua NodeMCU 导入 IntelliJ 以进行自动完成?
- angular - Angular 7:表单上的两种数据绑定
- javascript - JavaScript 替代关联数组
- android - distinctUntilChanged 不起作用(例如,不同的列表大小不被视为不同)
- html - wordpress 网站页面未正确加载
- python - Matplotlib 为图形添加字幕
- java - 更改 Android Studio 默认设置