Skip to content

Commit

Permalink
Simplify Apache2 configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
spelhate committed Jun 17, 2020
1 parent 163c1c8 commit cc9f1e9
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 52 deletions.
18 changes: 11 additions & 7 deletions server_configurations/apache2/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Configuration apache
Plusieurs configurations sont disponibles :
Deux configurations sont disponibles :

### Cas 1

Expand All @@ -13,9 +13,12 @@ La configuration apache permet de proxyfier les url disponibles sur le port appl

Utiliser la configuration apache **mreport_conf1.conf** et l'inclure dans la configuration du virtualhost apache2 eg:

Adapter tous les chemins pointant vers le dossier report de votre installation exemple :
Editer la variable MREPORT_LOCATION qui pointe vers le répertoire mreport :

``Include /home/mreport/server_configurations/apache2/mreport_conf1.conf``
```
Define MREPORT_LOCATION /home/mreport
Include ${MREPORT_LOCATION}/server_configurations/apache2/mreport_conf2.conf
```

Cette configuration inclue les configurations nécessaires dans conf/common et conf/flask.

Expand All @@ -27,8 +30,9 @@ Le frontend est uniquement servi par apache

Utiliser la configuration apache **mreport_conf2.conf** et l'inclure dans la configuration du virtualhost apache2 eg:

Adapter tous les chemins pointant vers le dossier report de votre installation exemple :
Editer la variable MREPORT_LOCATION qui pointe vers le répertoire mreport :

``Include /home/mreport/server_configurations/apache2/mreport_conf2.conf``

Cette configuration inclue les configurations nécessaires dans conf/common et conf/noflask.
```
Define MREPORT_LOCATION /home/mreport
Include ${MREPORT_LOCATION}/server_configurations/apache2/mreport_conf2.conf
```
5 changes: 0 additions & 5 deletions server_configurations/apache2/conf/common/api.conf

This file was deleted.

4 changes: 0 additions & 4 deletions server_configurations/apache2/conf/common/static.conf

This file was deleted.

4 changes: 0 additions & 4 deletions server_configurations/apache2/conf/flask/admin.conf

This file was deleted.

4 changes: 0 additions & 4 deletions server_configurations/apache2/conf/flask/mreport.conf

This file was deleted.

6 changes: 0 additions & 6 deletions server_configurations/apache2/conf/noflask/admin.conf

This file was deleted.

18 changes: 0 additions & 18 deletions server_configurations/apache2/conf/noflask/mreport.conf

This file was deleted.

22 changes: 20 additions & 2 deletions server_configurations/apache2/mreport_conf1.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
Include /home/spelhate/home/mreport/server_configurations/apache2/conf/common/*.conf
Include /home/spelhate/home/mreport/server_configurations/apache2/conf/flask/*.conf
ProxyPreserveHost On
<Location "/api">
ProxyPass "http://127.0.0.1:5000/api/"
ProxyPassReverse "http://127.0.0.1:5000/api/"
</Location>

Alias /static "${MREPORT_LOCATION}/frontend/static"
<Directory "${MREPORT_LOCATION}/frontend/static">
Require all granted
</Directory>

<Location "/admin/">
ProxyPass "http://127.0.0.1:5000/admin/"
ProxyPassReverse "http://127.0.0.1:5000/admin/"
</Location>

<Location "/mreport/">
ProxyPass "http://127.0.0.1:5000/mreport/"
ProxyPassReverse "http://127.0.0.1:5000/mreport/"
</Location>
38 changes: 36 additions & 2 deletions server_configurations/apache2/mreport_conf2.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
Include /home/spelhate/home/mreport/server_configurations/apache2/conf/common/*.conf
Include /home/spelhate/home/mreport/server_configurations/apache2/conf/noflask/*.conf
ProxyPreserveHost On
<Location "/api">
ProxyPass "http://127.0.0.1:5000/api/"
ProxyPassReverse "http://127.0.0.1:5000/api/"
</Location>

Alias /static "${MREPORT_LOCATION}/frontend/static"
<Directory "${MREPORT_LOCATION}/frontend/static">
Require all granted
</Directory>

Alias /admin "${MREPORT_LOCATION}/frontend/templates"
<Directory "${MREPORT_LOCATION}/frontend/templates">
DirectorySlash On
Require all granted
DirectoryIndex admin.html
</Directory>

# Create pseudo /main.html page and use it
# in directory index and fallbackResource
# by this way it's possible to server /main.html
# with urls like /report/, /mreport/report1/, /mreport/report1/dataid...

AliasMatch "^/main\.html$" "${MREPORT_LOCATION}/frontend/templates/index.html"

Alias "/mreport" "${MREPORT_LOCATION}/backend/reports"

<Directory "${MREPORT_LOCATION}/backend/reports">
Require all granted
DirectoryIndex /main.html
FallbackResource /main.html
<FilesMatch "\.(json|css|html|csv)$">
FallbackResource disabled
</FilesMatch>

</Directory>

0 comments on commit cc9f1e9

Please sign in to comment.