我正在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处理这条路线