Nginx Installation / DONE
Install Nginx:
apt-get install -y nginx
Example of Nginx configuration for the exchange:
You need to replace the
domain.com domain and
admin domain: admin.domain.com
/etc/nginx/sites-enabled/domain.conf
map $http_upgrade $connection_upgrade {
default upgrade;
"" close;
}
server {
listen 80;
server_name domain.com; return 301 https://www.domain.com$request_uri;
}
server {
listen 80;
server_name www.domain.com;
root "/var/www/exchanger-client-web";
gzip on;
gzip_comp_level 9;
gzip_disable "msie6";
gzip_types application/javascript text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
index index.html;
charset utf-8;
add_header "X-Frame-Options" "SAMEORIGIN";
add_header "X-XSS-Protection" "1; mode=block";
add_header "X-Content-Type-Options" "nosniff";
location / {
root /var/www/exchanger-client-web/dist/client;
rewrite ^([^.]*[^/])$ $1/ permanent;
try_files $uri $uri/ /200.html;
# expires 7d;
}
access_log off;
error_log /var/www/exchanger-client-web/nginx-error.log error;
sendfile off;
client_max_body_size 100m;
location /service/ {
proxy_pass http://127.0.0.1:3010/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
}
location /service/fs {
alias /var/www/exchanger-api/public;
}
location /tg/ {
proxy_pass http://127.0.0.1:3003/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
}
#location /service/fs {
# alias /var/www/exchanger-api/public;
#}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:3011/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_redirect off;
}
}
server {
listen 80;
server_name admin.domain.com;
root "/var/www/exchanger-admin-web";
gzip on;
gzip_comp_level 9;
gzip_disable "msie6";
gzip_types application/javascript text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
index index.html index.htm index.php;
charset utf-8;
add_header "X-Frame-Options" "DENY";
add_header "X-XSS-Protection" "1; mode=block";
add_header "X-Content-Type-Options" "nosniff";
location / {
root /var/www/exchanger-admin-web/dist/admin;
try_files $uri $uri/ /index.html;
# cache
# expires 7d;
}
access_log off;
error_log /var/www/exchanger-admin-web/nginx-error.log error;
sendfile off;
client_max_body_size 100m;
location /service/ {
proxy_pass http://127.0.0.1:3010/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
}
location /service/fs {
alias /var/www/exchanger-api/public;
}
}
Last updated