140 lines
3.3 KiB
Django/Jinja
140 lines
3.3 KiB
Django/Jinja
# {{ ansible_managed }}
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
server {
|
|
listen 80 default;
|
|
server_name _;
|
|
|
|
root /var/www/mtinfo3000/dip/webroot/;
|
|
client_max_body_size 10m;
|
|
index index.php;
|
|
|
|
set_real_ip_from 10.1.1.247;
|
|
real_ip_header X-Forwarded-For;
|
|
real_ip_recursive on;
|
|
|
|
access_log /var/log/nginx/access-di-dip.log;
|
|
error_log /var/log/nginx/error-di-dip.log;
|
|
|
|
## Favicon Not Found
|
|
location = /favicon.ico {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
location = /index.php {
|
|
include snippets/fastcgi-php.conf;
|
|
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
|
|
}
|
|
|
|
## Robots.txt Not Found
|
|
location = /robots.txt {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
{% for item in frontend_applications %}
|
|
{% if item.namespace != 'dip' %}
|
|
|
|
location ~ ^/{{ item.namespace }}(?:/(.*))?$ {
|
|
access_log /var/log/nginx/access-di-{{ item.namespace }}.log;
|
|
error_log /var/log/nginx/error-di-{{ item.namespace }}.log;
|
|
rewrite ^/{{ item.namespace }}$ /{{ item.namespace }}/ permanent;
|
|
rewrite ^/{{ item.namespace }}/(.+)$ /$1 break;
|
|
root /var/www/mtinfo3000/{{ item.namespace }}/webroot/;
|
|
try_files $uri $uri/ @{{ item.namespace }}_handler;
|
|
}
|
|
|
|
location @{{ item.namespace }}_handler {
|
|
set $q $request_uri;
|
|
include fastcgi_params;
|
|
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME /var/www/mtinfo3000/{{ item.namespace }}/webroot/index.php;
|
|
fastcgi_param QUERY_STRING $query_string;
|
|
}
|
|
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
# / (rewrite to index.php)
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$args;
|
|
}
|
|
|
|
# /git
|
|
location /git/ {
|
|
access_log /var/log/nginx/access-di-git.log;
|
|
error_log /var/log/nginx/error-di-git.log;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_pass http://{{ proxy_git_host }}:{{ proxy_git_port }}/;
|
|
}
|
|
|
|
# /ci
|
|
location ^~ /job/ {
|
|
rewrite ^/(.*) https://portal.dualinventive.com/ci$request_uri permanent;
|
|
}
|
|
|
|
location ^~ /view/ {
|
|
rewrite ^/(.*) https://portal.dualinventive.com/ci$request_uri permanent;
|
|
}
|
|
|
|
location ^~ /ci/ {
|
|
access_log /var/log/nginx/access-di-ci.log;
|
|
error_log /var/log/nginx/error-di-ci.log;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_pass http://{{ proxy_ci_host }}:{{ proxy_ci_port }}/ci/;
|
|
}
|
|
|
|
location ^~ /wiki/ {
|
|
access_log off;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_pass http://localhost:10080/wiki/;
|
|
}
|
|
|
|
location @wiki_handler {
|
|
rewrite ^/(.*)$ /index.php?title=$1&$args;
|
|
}
|
|
}
|
|
|
|
# /wiki
|
|
server {
|
|
listen 10080 default;
|
|
server_name _;
|
|
|
|
root /var/www;
|
|
|
|
client_max_body_size 5m;
|
|
index index.php;
|
|
access_log /var/log/nginx/access-di-wiki.log;
|
|
error_log /var/log/nginx/error-di-wiki.log;
|
|
|
|
location / {
|
|
try_files $uri $uri/ @rewrite;
|
|
}
|
|
|
|
location @rewrite {
|
|
rewrite ^/(.*)$ /wiki/index.php?title=$1&$args;
|
|
}
|
|
|
|
location ^~ /maintenance/ {
|
|
return 403;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
include fastcgi_params;
|
|
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
fastcgi_param QUERY_STRING $query_string;
|
|
}
|
|
}
|