added apache2 proxy setting

pull/143/head
Caozhenhui 2022-04-22 16:57:56 +08:00
parent 6c70ad48a1
commit 28cdf06664
2 changed files with 21 additions and 1 deletions

View File

@ -164,7 +164,7 @@ Listen 8001
sudo vi /etc/apache2/sites-available/000-default.conf sudo vi /etc/apache2/sites-available/000-default.conf
``` ```
Add a new 'VirtualHost' as below Add a new 'VirtualHost' as below
```xml ```
<VirtualHost 127.0.0.1:8001> <VirtualHost 127.0.0.1:8001>
ServerAdmin MyEMS-admin ServerAdmin MyEMS-admin
DocumentRoot /var/www/myems-admin DocumentRoot /var/www/myems-admin
@ -173,9 +173,19 @@ Add a new 'VirtualHost' as below
Options FollowSymLinks Options FollowSymLinks
AllowOverride All AllowOverride All
Require all granted Require all granted
Header set Access-Control-Allow-Origin *
</Directory> </Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
ProxyPass /api http://127.0.0.1:8000/
ProxyPassReverse /api http://127.0.0.1:8000/
</VirtualHost> </VirtualHost>
``` ```

View File

@ -230,9 +230,19 @@ Add a new 'VirtualHost' as below
Options FollowSymLinks Options FollowSymLinks
AllowOverride All AllowOverride All
Require all granted Require all granted
Header set Access-Control-Allow-Origin *
</Directory> </Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
ProxyPass /api http://127.0.0.1:8000/
ProxyPassReverse /api http://127.0.0.1:8000/
</VirtualHost> </VirtualHost>
``` ```