Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
b975e41a
Commit
b975e41a
authored
Nov 28, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update the doc for final nginx wrapping infos (TODO more)
parent
e333c8c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
25 deletions
+63
-25
README.md
README.md
+7
-6
nginx_conf.md
doc/nginx_conf.md
+56
-19
No files found.
README.md
View file @
b975e41a
...
@@ -13,9 +13,9 @@ More info in `doc/` directory
...
@@ -13,9 +13,9 @@ More info in `doc/` directory
-------
-------
##
#
Setting up the servers
## Setting up the servers
###
#
Running it all via docker
### Running it all via docker
Prerequisites:
Prerequisites:
-
`docker`
-
`docker`
-
`docker-compose`
(>= v. 1.7.0)
-
`docker-compose`
(>= v. 1.7.0)
...
@@ -118,9 +118,10 @@ The form server is then accessible locally on `0.0.0.0:9090/regcomex`
...
@@ -118,9 +118,10 @@ The form server is then accessible locally on `0.0.0.0:9090/regcomex`
-------
-------
### Running in prod
####
Running in prod
####
Nginx
TODO => w
e ask nginx to reverse-proxy our app
W
e ask nginx to reverse-proxy our app
This is a minimal conf (cf
[
detailed doc
](
https://github.com/moma/regcomex/blob/master/doc/nginx_conf.md
)
for real-life conf)
This is a minimal conf (cf
[
detailed doc
](
https://github.com/moma/regcomex/blob/master/doc/nginx_conf.md
)
for real-life conf)
...
@@ -130,7 +131,7 @@ server {
...
@@ -130,7 +131,7 @@ server {
listen 80;
listen 80;
location /$ROUTE_PREFIX {
location /$ROUTE_PREFIX {
proxy_pass http://
127.0.0.1
:9090;
proxy_pass http://
0.0.0.0
:9090;
}
}
}
}
```
```
...
@@ -143,7 +144,7 @@ Currently the data is collected in `data/shared_mysql_data`
...
@@ -143,7 +144,7 @@ Currently the data is collected in `data/shared_mysql_data`
The communityexplorer.org app is using a separate DB from legacy wiki csv
The communityexplorer.org app is using a separate DB from legacy wiki csv
(cf
[
detailed doc
](
https://github.com/moma/regcomex/blob/master/doc/nginx_conf.md
)
for real-life conf)
(cf
[
detailed doc
](
https://github.com/moma/regcomex/blob/master/doc/nginx_conf.md
)
for real-life conf)
**TODO:**
connect the two
**TODO:**
connect the two
DBs
-------
-------
...
...
doc/nginx_conf.md
View file @
b975e41a
## Nginx configuration
Independantly from the backends like mysql or doors, the comex app is in two parts:
-
the legacy php comex app
-
the new python registration app
A good way to make the two coexist is to use nginx as follows
### 1) Install nginx
### 1) Install nginx
If you don't already have nginx on the deployment machine, follow these steps first:
```
```
sudo service apache2 stop
sudo service apache2 stop
sudo apt install nginx-full
# contains uwsgi http module
sudo apt install nginx-full
# check the status
# check the status
s
ystemctl status nginx.service # or s
udo service nginx status
sudo service nginx status
```
```
### 2) Replace nginx conf by our *comex+reg* configuration
### 2) Add regcomex to nginx conf
Create the conf files for comex
Create the conf files for regcomex
```
```
cd /etc/nginx/sites-available
cd /etc/nginx/sites-available
sudo nano
reg
comex.conf
sudo nano comex.conf
```
```
Exemple content to add in
`/etc/nginx/sites-available/regcomex.conf`
This below is a full config exemple you can paste in nano:
```
-
it serves the comex app (legacy php), in
`/`
-
it also serves registration app, in
`/regcomex`
```ini
# Full server config: php comex as root and regcomex as subpath
# =============================================================
server {
server {
# your normal server conf here
listen 80 ;
#listen 80;
listen [::]:80 ;
#listen [::]:80;
#root /var/www ;
location /regcomex {
server_name _;
proxy_pass http://127.0.0.1:9090; # gunicorn will be serving here
# adapt path to your php docroot
root /home/romain/comex/www ;
location / {
index index.html index.php ;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
# here we adapted $documentroot to our real php docroot
fastcgi_param SCRIPT_FILENAME /home/romain/comex/www/$fastcgi_script_name;
# -----------------------
}
# no root here => independant app
# (but /locationpath must match this app's default route)
location /regcomex {
# point to gunicorn server
proxy_pass http://0.0.0.0:9090;
proxy_redirect off;
proxy_redirect off;
# useful to keep track of original IP before reverse-proxy
# useful to keep track of original IP before reverse-proxy
...
@@ -40,8 +70,9 @@ server {
...
@@ -40,8 +70,9 @@ server {
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Host $server_name;
# get the logs in a custom place
# get the logs in a custom place
access_log /home/romain/comex/regcomex/logs/nginx/access.log;
# (adapt paths)
error_log /home/romain/comex/regcomex/logs/nginx/error.log;
access_log /home/romain/comex/regcomex/logs/nginx/access.log ;
error_log /home/romain/comex/regcomex/logs/nginx/error.log debug;
}
}
# faster static serving
# faster static serving
...
@@ -50,12 +81,18 @@ server {
...
@@ -50,12 +81,18 @@ server {
autoindex on;
autoindex on;
}
}
location ~ /\.ht {
deny all;
}
}
}
```
```
Finally enable the conf
Finally, to enable the conf:
```
```
cd /etc/nginx/sites-enabled
cd /etc/nginx/sites-enabled
sudo ln -s ../sites-available/regcomex.conf
sudo ln -s ../sites-available/regcomex.conf
```
```
**NB:**
If you use this configuration without changing anything else than the paths, then
*remove*
all other confs from
`sites-enabled`
(because this one is written to be standalone)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment