wordpress - 使用 apache proxypass 重定向到 /blog (wordpress)
问题描述
我在https://www.hackachieve.com上运行一个 ReactJS 应用程序,其结构如下:
端口 80/443:前端 - ReactJS SPA 端口:8000 - 后端 - django rest framework API
我已经在 /var/www/html 上正确安装了 wordpress,我正在尝试将用户从 /blog 重定向到它。
问题是我的代理通行证不起作用。当用户尝试访问https://www.hackachieve.com/blog时发生的情况是它被重定向回主页 /。我通过检查 devtools 发现了 301 重定向。
/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName hackachieve.com
ServerAlias www.hackachieve.com
ServerAdmin joaopaulofurtado@live.com
DocumentRoot /var/www/hackachieve-frontend
ProxyPreserveHost On
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
RewriteEngine on
RewriteCond %{SERVER_NAME} =hackachieve.com [OR]
RewriteCond %{SERVER_NAME} =www.hackachieve.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerName hackachieve.com
ServerAlias www.hackachieve.com
ServerAdmin joaopaulofurtado@live.com
DocumentRoot /var/www/hackachieve-frontend
ProxyPreserveHost On
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
ErrorLog ${APACHE_LOG_DIR}/error-frontend.log
CustomLog ${APACHE_LOG_DIR}/access-frontend.log combined
RewriteEngine off
RewriteCond %{SERVER_NAME} =www.hackachieve.com [OR]
RewriteCond %{SERVER_NAME} =hackachieve.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLEngine on
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/hackachieve.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hackachieve.com/privkey.pem
</VirtualHost>
<VirtualHost *:8000>
ServerName hackachieve.com
ServerAlias www.hackachieve.com
ServerAdmin joaopaulofurtado@live.com
DocumentRoot /var/www/hackachieve-backend
ErrorLog ${APACHE_LOG_DIR}/error-backend.log
CustomLog ${APACHE_LOG_DIR}/access-backend.log combined
Alias /static /var/www/hackachieve-backend/static
<Directory /var/www/hackachieve-backend/static>
Require all granted
</Directory>
<Directory /var/www/hackachieve-backend/hackachieve>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIPassAuthorization On
WSGIDaemonProcess hackachieve python-home=/var/www/hackachieve-backend/venv python-path=/var/www/hackachieve-backend
WSGIProcessGroup hackachieve
WSGIScriptAlias / /var/www/hackachieve-backend/hackachieve/wsgi.py
SSLEngine on
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/hackachieve.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hackachieve.com/privkey.pem
</VirtualHost>
我希望当用户访问https://www.hackachieve.com/blog时,他会被重定向到我的 Wordpress 博客。
我不想让 ReactJS 处理这条路线
解决方案
推荐阅读
- ios - 调整自定义 Tableviewcell - NSLayoutConstraint 冲突。UIView-Encapsulated-Layout-Height
- python - 如何从 gitlab 包安装 pypi 包?
- javascript - 我有一个对象“banco”,我想通过此属性的属性值获取对象的属性名称。(例如:“553592729970@c.us”)
- discord - 我如何制作一个告诉系统状态的不和谐机器人
- javascript - JointJS:无法使用 JSON 以自定义形状显示 foreignObject
- firebase - 没有为“BuildContext”类型定义方法“showSnackBar”
- scheme - 如何创建像球拍一样的make-curry功能
- python - 如何获取另一个类的预定义属性
- r - R Shiny app中conditionalPanel()的优化
- r - 当指定 x 和 mu 并将结果附加为列时,对 df 的多行执行 t 检验