133 lines
3.4 KiB
Nginx Configuration File
133 lines
3.4 KiB
Nginx Configuration File
user root;
|
|
worker_processes 4;
|
|
|
|
#error_log logs/error.log;
|
|
error_log logs/error.log;
|
|
#error_log logs/error.log info;
|
|
|
|
#pid logs/nginx.pid;
|
|
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
# rewrite_log on;
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
client_max_body_size 128M;
|
|
|
|
#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 logs/access.log main;
|
|
|
|
sendfile on;
|
|
#tcp_nopush on;
|
|
|
|
keepalive_timeout 65;
|
|
|
|
gzip on;
|
|
|
|
upstream cas {
|
|
server 127.0.0.1:8081;
|
|
}
|
|
|
|
upstream cms {
|
|
server 127.0.0.1:8082;
|
|
}
|
|
|
|
upstream cms2 {
|
|
server 127.0.0.1:8087;
|
|
}
|
|
|
|
upstream openapi {
|
|
server 127.0.0.1:8084;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
server_name localhost;
|
|
charset utf-8;
|
|
|
|
#access_log logs/host.access.log main;
|
|
|
|
location / {
|
|
root html;
|
|
index index.html index.htm;
|
|
}
|
|
|
|
location /download/phone {
|
|
add_header Content-Disposition 'attachment; filename="MicroSIP-Lite-3.20.0.zip"';
|
|
alias /data/program/download/MicroSIP-Lite-3.20.0.zip;
|
|
}
|
|
|
|
location /cas {
|
|
proxy_pass http://cas;
|
|
proxy_redirect off;
|
|
proxy_set_header Host $host:$server_port;
|
|
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;
|
|
}
|
|
|
|
# CMS Static
|
|
rewrite ^/(cms|cms2)$ /$1/ permanent;
|
|
location /cms {
|
|
alias /data/program/cms-static;
|
|
index index.html;
|
|
}
|
|
|
|
location /cms2 {
|
|
alias /data/program/cms-static;
|
|
index index.html;
|
|
}
|
|
|
|
# CMS API
|
|
rewrite ^/(cms|cms2)/api$ /$1/api/ permanent;
|
|
rewrite ^/(cms|cms2)/cas/(.+)$ /$1/api/cas/$2 break;
|
|
rewrite ^/(cms|cms2)/logout$ /$1/api/logout break;
|
|
location ~ ^/(cms|cms2)/api/ {
|
|
|
|
rewrite ^/(cms|cms2)/api/(.*) /$2 break;
|
|
proxy_pass http://$1;
|
|
proxy_redirect off;
|
|
proxy_set_header Host $host:$server_port;
|
|
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;
|
|
}
|
|
|
|
rewrite ^/openapi$ /openapi/ permanent;
|
|
location /openapi {
|
|
rewrite ^/openapi/(.*)$ /$1 break;
|
|
proxy_pass http://openapi;
|
|
proxy_redirect off;
|
|
proxy_set_header Host $host:$server_port;
|
|
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;
|
|
}
|
|
|
|
location /rec {
|
|
root /var/lib/freeswitch/recordings;
|
|
rewrite "^/rec/(([^_]+)_(\d{4})\-(\d{2})-(\d{2})_(\d{2})\-(\d{2})\-(\d{2})(_\w+)?([^.]+)?\.(\w+))$" "/$3/$4/$5/$6/$1" break;
|
|
}
|
|
|
|
location /sound {
|
|
root /data/program;
|
|
}
|
|
|
|
#error_page 404 /404.html;
|
|
|
|
# redirect server error pages to the static page /50x.html
|
|
#
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root html;
|
|
}
|
|
}
|
|
}
|