首页 > 解决方案 > Nginx:主域上的 Nuxtjs 应用程序 + 子目录中的 WordPress

问题描述

我有一个 nuxtjs 应用程序https://damjanun.com/使用 nginx 代理设置在主域上运行。现在我们需要在子目录中安装 wordpress,即:https ://damjanun.com/blog 。我无法完成它。

标签: wordpressnginxreverse-proxynuxt.js

解决方案


找到了解决方案。这是我的 damjanun.com 的 nginx 配置文件。该博客也可以正常工作https://damjanun.com/blog

location /blog {
   try_files $uri $uri/ /blog/index.php?q=$1;
}

location ~ \.php$ {
   include snippets/fastcgi-php.conf;
   fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}

location / {
   proxy_pass http://localhost:3000;
   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;
}

推荐阅读