[Nginx:主域上的Nuxtjs应用+子目录中的WordPress

问题描述 投票:0回答:1

我有一个使用nginx代理设置在主域上运行的nuxtjs应用https://damjanun.com/。现在,我们需要在子目录(即https://damjanun.com/blog)中安装wordpress。我做不完

wordpress nginx reverse-proxy nuxt.js
1个回答
0
投票

找到了解决方案。这是我的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;
}
© www.soinside.com 2019 - 2024. All rights reserved.