首页 > 解决方案 > 在nodejs网站中使用wordpress for /blog路由不起作用

问题描述

我在我的 apache2 服务器配置中创建了一个这样的虚拟主机:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName test.co
    ServerAdmin webmaster@localhost

    #wordpress
    Alias /blog "/var/www/test_wp/public_html"

    <Directory "/var/www/test_wp/public_html">
       Options None
       AllowOverride None
       Order allow,deny
       Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    SSLCertificateFile /etc/letsencrypt/live/test.co/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/test.co/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

我正在使用别名将 /blog url (test.co/blog) 重定向到我服务器中的 wordpress 文件夹。

我正在为 nodejs 网站使用 proxypass。

但是当我点击 test.co/blog 时,它在我的 nodejs 网站中显示 404 not found

标签: node.jswordpressapachevhostsmod-vhost-alias

解决方案


遵循这个:从虚拟主机 proxypass 中排除别名

添加这一行:

ProxyPassMatch ^/blog !
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

推荐阅读