Allow use of nginx on Windows

- Remove headers_more module lines (not needed)
- Improve docs
This commit is contained in:
Will Abson 2016-11-14 17:10:02 +00:00 committed by Mario Romano
parent 4c95ed1f71
commit 8174de8fc8
2 changed files with 26 additions and 59 deletions

View File

@ -6,6 +6,7 @@ The [Angular 2](https://angular.io/) based application development framework req
- [Download and install Activiti](https://www.alfresco.com/products/bpm/alfresco-activiti/trial) - [Download and install Activiti](https://www.alfresco.com/products/bpm/alfresco-activiti/trial)
- [Node.js](https://nodejs.org/en/) JavaScript runtime. - [Node.js](https://nodejs.org/en/) JavaScript runtime.
- [npm](https://www.npmjs.com/) package manager for JavaScript. - [npm](https://www.npmjs.com/) package manager for JavaScript.
- local nginx proxy to avoid cross-origin browser restrictions (see below)
- (If you use ECM and BPM together) Make sure your user has the same username and password in both system - (If you use ECM and BPM together) Make sure your user has the same username and password in both system
*Note: Default username for activiti is "admin@app.activiti.com" and "admin" for Alfresco, and also the default password are different. Change them to be equal.* *Note: Default username for activiti is "admin@app.activiti.com" and "admin" for Alfresco, and also the default password are different. Change them to be equal.*
@ -25,26 +26,39 @@ $ node -v
v5.12.0 v5.12.0
``` ```
## Configure Nginx ## Installing nginx
To correctly configure Nginx use the following file [nginx.conf](/nginx.conf). Most Linux distributions will come with nginx available to install via your
This will put Activiti, Alfresco and the app dev framework under the same domain. package manager and on Mac OS you can use [Homebrew](http://brew.sh/).
If you want to install manually however you can follow the instructions on the
[download page](http://nginx.org/en/download.html). See also the specific information for
[windows users](http://nginx.org/en/docs/windows.html).
### Start nginx
Start nginx using the supplied configuration in [nginx.conf](nginx.conf)
nginx -c nginx.conf
### Review nginx configuration
To correctly configure nginx use the following file [nginx.conf](/nginx.conf).
This will host Activiti, Alfresco and the app dev framework under the same origin.
* ECM : http://localhost:8888/alfresco/ * ECM : http://localhost:8888/alfresco/
* BPM : http://localhost:8888/activiti/ * BPM : http://localhost:8888/activiti/
To make everything work, you have to change the address of the ECM and BPM. In the demo app you can do that clicking on the top left menu and changing the bottom left options: ECM host and BPM host. To make everything work, you have to change the address of the ECM and BPM. In the demo app you can do that clicking on the top right settings menu and changing the bottom left options: *ECM host* and *BPM host*.
This configuration assumes few things: This configuration assumes few things:
* Port mapping: * Port mapping:
* Nginx entry point: 8888 * nginx entry point: 0.0.0.0:8888
* Demo Shell: 3000 * Demo Shell: locathost:3000
* Alfresco: 8080 * Alfresco: locathost:8080
* Activiti: 9999 * Activiti: locathost:9999
All those values can be modified at their respective `location` directive on the [nginx.conf](/nginx.conf) file. All those values can be modified at their respective `location` directive on the [nginx.conf](/nginx.conf) file.
It also need to be compiled with the [Headers More](https://www.nginx.com/resources/wiki/modules/headers_more/) module , which add more control over sending headers to the backend. If you want to know more on how to install and configure nginx to work with the Application Development Framework can be found [here](https://community.alfresco.com/community/application-development-framework/blog/2016/09/28/adf-development-set-up-with-nginx-proxy)
If you want to know more on how to install and configure Nginx to work with the Application Development Framework can be found [here](https://community.alfresco.com/community/application-development-framework/blog/2016/09/28/adf-development-set-up-with-nginx-proxy)

View File

@ -35,7 +35,7 @@ http {
server { server {
listen 8888; listen 8888;
server_name dev-platform-proxy; server_name dev-platform-proxy;
#set $allowOriginSite http://127.0.0.1:3000; #set $allowOriginSite http://127.0.0.1:3000;
set $allowOriginSite *; set $allowOriginSite *;
@ -55,26 +55,6 @@ http {
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie; proxy_pass_header Set-Cookie;
if ($request_method = 'OPTIONS') {
more_set_headers 'Access-Control-Allow-Origin: $allowOriginSite';
#
# Om nom nom cookies
#
more_set_headers 'Access-Control-Allow-Credentials: true';
more_set_headers 'Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
more_set_headers 'Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Content-Range, Content-Disposition, Content-Description, X-CSRF-TOKEN, Authorization';
#
# Tell client that this pre-flight info is valid for 20 days
#
more_set_headers 'Access-Control-Max-Age: 1728000';
more_set_headers 'Content-Type: text/plain charset=UTF-8';
more_set_headers 'Content-Length 0';
return 204;
}
} }
location /activiti/ { location /activiti/ {
@ -87,33 +67,6 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie; proxy_pass_header Set-Cookie;
proxy_pass_request_headers on; proxy_pass_request_headers on;
if ($request_method = 'OPTIONS') {
more_set_headers 'Access-Control-Allow-Origin: $allowOriginSite';
#
# Om nom nom cookies
#
more_set_headers 'Access-Control-Allow-Credentials: true';
more_set_headers 'Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
more_set_headers 'Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Content-Range, Content-Disposition, Content-Description, X-CSRF-TOKEN, Authorization';
#
# Tell client that this pre-flight info is valid for 20 days
#
more_set_headers 'Access-Control-Max-Age: 1728000';
more_set_headers 'Content-Type: text/plain charset=UTF-8';
more_set_headers 'Content-Length 0';
return 204;
}
if ($request_method = 'POST') {
more_set_headers 'Access-Control-Allow-Origin: $allowOriginSite';
more_set_headers 'Access-Control-Allow-Credentials: true';
more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, DELETE';
more_set_headers 'Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Content-Range, Content-Disposition, Content-Description, X-CSRF-TOKEN, Authorization';
}
} }
location / { location / {