This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added proxy settings for nginx in jiskefet-role
- Loading branch information
Patrick Hendriks
committed
Jul 25, 2019
1 parent
1a67704
commit 576d3db
Showing
8 changed files
with
193 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,7 @@ | |
tags: | ||
- git_pull | ||
|
||
- import_tasks: setupproxynginx.yml | ||
tags: | ||
- git_pull | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- name: Copy custom proxy.conf from local to remote | ||
template: | ||
src: proxy.conf.j2 | ||
dest: /etc/nginx/conf.d/proxy.conf | ||
become_method: sudo | ||
tags: configuration | ||
|
||
- name: Replace default nginx.conf | ||
template: | ||
src: nginx.conf.j2 | ||
dest: /etc/nginx/nginx.conf | ||
become_method: sudo | ||
tags: configuration | ||
|
||
- name: Change owner of folder /var/lib/nginx to {{ jiskefet_user }} | ||
file: | ||
path: /var/lib/nginx | ||
state: directory | ||
recurse: yes | ||
owner: "{{ jiskefet_user }}" | ||
group: "{{ jiskefet_user }}" | ||
become_method: sudo | ||
tags: configuration | ||
|
||
- name: Remove default.conf | ||
file: | ||
path: /etc/nginx/conf.d/default.conf | ||
state: absent | ||
|
||
- name: Test NGiNX config | ||
command: nginx -T | ||
become_method: sudo | ||
tags: configuration | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# /* | ||
# * Copyright (C) 2018 Amsterdam University of Applied Sciences (AUAS) | ||
# * | ||
# * This software is distributed under the terms of the | ||
# * GNU General Public Licence version 3 (GPL) version 3, | ||
# * copied verbatim in the file "LICENSE" | ||
# */ | ||
|
||
user {{ jiskefet_user }}; | ||
worker_processes auto; | ||
error_log /var/log/nginx/error.log; | ||
pid /run/nginx.pid; | ||
|
||
# Load dynamic modules. See /usr/share/nginx/README.dynamic. | ||
include /usr/share/nginx/modules/*.conf; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
# Load modular configuration files from the /etc/nginx/conf.d directory. | ||
# See http://nginx.org/en/docs/ngx_core_module.html#include | ||
# for more information. | ||
include /etc/nginx/conf.d/*.conf; | ||
|
||
# Settings for a TLS enabled server. | ||
# | ||
# server { | ||
# listen 443 ssl http2 default_server; | ||
# listen [::]:443 ssl http2 default_server; | ||
# server_name _; | ||
# root /usr/share/nginx/html; | ||
# | ||
# ssl_certificate "/etc/pki/nginx/server.crt"; | ||
# ssl_certificate_key "/etc/pki/nginx/private/server.key"; | ||
# ssl_session_cache shared:SSL:1m; | ||
# ssl_session_timeout 10m; | ||
# ssl_ciphers HIGH:!aNULL:!MD5; | ||
# ssl_prefer_server_ciphers on; | ||
# | ||
# # Load configuration files for the default server block. | ||
# include /etc/nginx/default.d/*.conf; | ||
# | ||
# location / { | ||
# } | ||
# | ||
# error_page 404 /404.html; | ||
# location = /40x.html { | ||
# } | ||
# | ||
# error_page 500 502 503 504 /50x.html; | ||
# location = /50x.html { | ||
# } | ||
# } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# /* | ||
# * Copyright (C) 2018 Amsterdam University of Applied Sciences (AUAS) | ||
# * | ||
# * This software is distributed under the terms of the | ||
# * GNU General Public Licence version 3 (GPL) version 3, | ||
# * copied verbatim in the file "LICENSE" | ||
# */ | ||
|
||
server { | ||
## port to listen on | ||
listen 80; | ||
listen [::]:80; | ||
listen 443; | ||
listen [::]:443; | ||
## set root directory | ||
root /var/lib/jiskefet/jiskefet-ui/; | ||
|
||
## if a page is not specified look for index.html | ||
index src/index.html; | ||
|
||
## when root is accessed, go to whatever is specified in block | ||
location / { | ||
autoindex on; | ||
try_files $uri /src/index.html; # used for not resolving the oauth callback in url /callback | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
add_header Content-Security-Policy {{ allow_csp_payload }}; | ||
} | ||
|
||
## reverse proxy | ||
location /api/ { | ||
proxy_pass http://localhost:{{ jiskefet_api_general_settings.PORT }}/; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection 'upgrade'; | ||
proxy_set_header Host $host; | ||
proxy_cache_bypass $http_upgrade; | ||
client_max_body_size {{ (file_upload_limit | int) * 1024 * 1024 }}; # Setting the file upload limit for the API | ||
} | ||
|
||
## Media: images, icons, video, audio, HTC | ||
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { | ||
expires 1M; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
## CSS and Javascript | ||
#location ~* \.(?:css|js)$ { | ||
# expires 1y; | ||
# access_log off; | ||
# add_header Cache-Control "public"; | ||
#} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
--- | ||
use_local_repository: 'no' | ||
file_upload_limit: 500000 | ||
|
||
remote_repository_url: | ||
JISKEFET_UI: https://github.com/SoftwareForScience/jiskefet-ui.git | ||
repository_branch: | ||
JISKEFET_UI: develop | ||
|
||
|
||
allow_csp_payload: >- | ||
"default-src 'self' http://{{ inventory_hostname }} https://{{ inventory_hostname }} | ||
http://localhost:{{jiskefet_api_general_settings.PORT}} https://localhost:{{jiskefet_api_general_settings.PORT}} | ||
https://github.com https://api.github.com; script-src 'self' https://use.fontawesome.com/releases/v5.3.1/js/all.js | ||
https://github.com https://api.github.com; style-src 'self' 'unsafe-inline'; object-src 'none'; font-src 'self' | ||
data: fonts.gstatic.com; img-src https://*.githubusercontent.com | ||
http://{{ inventory_hostname }} https://{{ inventory_hostname }}" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters