静态文件的nginx配置
我需要一个建议,如何解决这个问题:
我有两个网站example1.com和example2.com 他们都在nuxtjs上做得很好。
对于他们来说,我正在使用nginx。
我需要这样做: 如果我打算地址example2.com/custompage,我需要从example1.com/custompage 中显示页面和静态文件(我不需要在此页面上重定向,我需要在example2.com/custompage上准确显示此页面),但是当我转到示例2.com的任何其他页面时,我需要将所有页面和文件保留在example2.com中
是否可以使用nginx执行此操作?
I need an advice, how to solve this:
I have two websites example1.com and example2.com
They both made on NuxtJS and works well.
For them I am using Nginx.
I need to do this:
If I going to address example2.com/custompage I need to show page and static files from example1.com/custompage (I am not need redirect on this page, I need to show this page exactly on example2.com/custompage), but when I going to any other page of example2.com I need to keep all pages and files from example2.com
Is it possible to do this with Nginx?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
proxy_pass
。首先,在两个端口中运行NUXTJS应用程序,例如3000
和3001
,然后使用代理通行证和上游You can use
proxy_pass
. First, run NuxtJS apps in two ports like3000
and3001
then use proxy pass and upstream to do that遵循上述步骤之后。
在NUXT项目(NUXT1)中,您需要将以下内容添加到NUXT.CONFIG.JS文件中,
还请注意,如果您使用的是
static
文件夹中的任何文件,则示例图像,示例,示例。 PNG。您必须使用它们,例如
和
而不是
,如果您使用的是动态变量,请在.env中添加一个变量
After following the steps mentioned above.
In your Nuxt Project(nuxt1), you need to add the following to your nuxt.config.js file,
Also, note if you are using any files from the
Static
folder, example an image , example.png.You have to use them like
And
NOT
,If you are using dynamic variable, add an variable in .env , for the router.base