Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##
- # You should look at the following URL's in order to grasp a solid understanding
- # of Nginx configuration files in order to fully unleash the power of Nginx.
- # https://www.nginx.com/resources/wiki/start/
- # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
- # https://wiki.debian.org/Nginx/DirectoryStructure
- #
- # In most cases, administrators will remove this file from sites-enabled/ and
- # leave it as reference inside of sites-available where it will continue to be
- # updated by the nginx packaging team.
- #
- # This file will automatically load configuration files provided by other
- # applications, such as Drupal or Wordpress. These applications will be made
- # available underneath a path with that package name, such as /drupal8.
- #
- # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
- server {
- listen 80; # указываем порт, по которому nginx будет слушать запросы
- location / {
- return 301 https://$host$request_uri;
- }
- location ^~ /.well-known/acme-challenge/ {
- # Set correct content type. According to this:
- # https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
- # Current specification requires "text/plain" or no content header at all.
- # It seems that "text/plain" is a safe option.
- default_type "text/plain";
- # This directory must be the same as in /etc/letsencrypt/cli.ini
- # as "webroot-path" parameter. Also don't forget to set "authenticator" parameter
- # there to "webroot".
- # Do NOT use alias, use root! Target directory is located here:
- # /var/www/common/letsencrypt/.well-known/acme-challenge/
- root /var/www/html;
- }
- }
- server {
- listen 443 ssl default_server;
- listen [::]:443 ssl default_server;
- ssl_certificate /etc/letsencrypt/live/partnership.dev.pik-digital.ru/fullchain.pem; # managed by Certbot
- ssl_certificate_key /etc/letsencrypt/live/partnership.dev.pik-digital.ru/privkey.pem; # managed by Certbot
- root /var/www/html;
- index index.html index.htm index.nginx-debian.html;
- server_name partnership.dev.pik-digital.ru;
- location /sockjs-node/ {
- proxy_pass http://localhost:4200; # указываем порт нашего приложения
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Host $host;
- }
- location ^~ /api/v1.0/ {
- proxy_pass http://dotnet;
- proxy_set_header Host $host;
- }
- location ^~ /health/ {
- proxy_pass http://mobile;
- proxy_set_header Host $host;
- }
- location ^~ /.well-known/openid-configuration {
- proxy_pass http://auth;
- proxy_set_header Host $host;
- }
- location ^~ /news. {
- proxy_pass http://mobile;
- proxy_set_header Host $host;
- }
- location ^~ /project. {
- proxy_pass http://mobile;
- proxy_set_header Host $host;
- }
- location ^~ /auth. {
- proxy_pass http://auth;
- proxy_set_header Host $host;
- }
- location ^~ /selling. {
- proxy_pass http://mobile;
- proxy_set_header Host $host;
- }
- location ^~ /feed. {
- proxy_pass http://mobile;
- proxy_set_header Host $host;
- }
- location /mobile {
- rewrite /mobile(.*) /$1 break;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- proxy_pass http://auth;
- proxy_set_header Host $host;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
- location /smpp {
- rewrite /smpp(.*) /$1 break;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- proxy_pass http://smpp;
- proxy_set_header Host $host;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
- location /api-docs/mobile/ {
- rewrite /api-docs/mobile(.*) $1 break;
- proxy_pass http://mobile;
- proxy_set_header Host $host;
- }
- location /api-docs/ {
- rewrite ^/api-docs(.*) $1 break;
- proxy_pass http://dotnet/swagger;
- proxy_set_header Host $host;
- }
- location / {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- proxy_pass http://localhost:4200;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection keep-alive;
- proxy_set_header Host $host;
- proxy_cache_bypass $http_upgrade;
- }
- }
- upstream dotnet {
- server localhost:5000;
- }
- upstream mobile {
- server localhost:5001;
- }
- upstream smpp {
- server localhost:3000;
- }
- upstream auth {
- server localhost:5004;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement