Advertisement
MrKira

Untitled

Jul 5th, 2022
1,652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 14.68 KB | None | 0 0
  1. server {
  2.     if ($host = develop.wikiworks.io) {
  3.         return 301 https://$host$request_uri;
  4.     } # managed by Certbot
  5.  
  6.  
  7.     # Server
  8.     listen                      80;
  9.     server_name                 .develop.wikiworks.io;
  10.     if ($scheme = http) {
  11.         return 301 https://$host$request_uri;
  12.     }
  13.  
  14.  
  15. }
  16.  
  17.  
  18. server {
  19.     listen  443 ssl http2;
  20. #    listen 80;
  21.     server_name vireas.develop.wikiworks.io;
  22.     charset     utf-8;
  23. #    ssl_certificate         /etc/nginx/ssl/wikiworks.crt;
  24. #    ssl_certificate_key     /etc/nginx/ssl/wikiworks.key;
  25.     ssl_certificate         /etc/letsencrypt/live/stage.wikiworks.io/fullchain.pem;
  26.     ssl_certificate_key     /etc/letsencrypt/live/stage.wikiworks.io/privkey.pem;
  27.  
  28.  
  29.     error_page 502 @zagl;
  30.     error_page 503 @zagl;
  31.     error_page 302 @zagl;
  32.  
  33.     location /static-err/
  34.     {
  35.           proxy_pass http://127.0.0.1:9999;
  36.     }
  37.  
  38.     access_log /var/log/nginx/wikiworks_main_access_log;
  39.     error_log /var/log/nginx/wikiworks_main_error_log;
  40.  
  41.     if ($scheme = http) {
  42.         return 301 https://$host$request_uri;
  43.     }
  44.  
  45.     client_max_body_size        6144M;
  46.     client_body_buffer_size     4M;
  47.  
  48.     proxy_connect_timeout       600;
  49.     proxy_send_timeout          600;
  50.     proxy_read_timeout          600;
  51.     send_timeout                600;
  52.     uwsgi_read_timeout          600;
  53.  
  54.    location ~ ^/api/v1/ {
  55.  
  56.  
  57.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  58.       proxy_set_header X-Forwarded-Proto $scheme;
  59.       proxy_set_header Host $http_host;
  60.       proxy_redirect off;
  61.  
  62.  
  63. #      proxy_pass http://127.0.0.1:8000;
  64.       proxy_pass http://192.168.122.137:8000;
  65.  
  66.     }
  67.    
  68.     location ~ ^/download/ {
  69.  
  70.  
  71.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  72.       proxy_set_header X-Forwarded-Proto $scheme;
  73.       proxy_set_header Host $http_host;
  74.       proxy_redirect off;
  75.  
  76.  
  77. #      proxy_pass http://127.0.0.1:8000;
  78.       proxy_pass http://192.168.122.137:8000;
  79.  
  80.     }
  81.  
  82.     location ~ ^/media/ {
  83.  
  84.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  85.       proxy_set_header X-Forwarded-Proto $scheme;
  86.       proxy_set_header Host $http_host;
  87.       proxy_redirect off;
  88.  
  89.  
  90. #      proxy_pass http://127.0.0.1:8000;
  91.       proxy_pass http://192.168.122.137:8000;
  92.  
  93.     }
  94.  
  95.     location ~ ^/django_query_profiler/ {
  96.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  97.         proxy_set_header X-Forwarded-Proto $scheme;
  98.     proxy_set_header Host $http_host;
  99.         proxy_redirect off;
  100.  
  101. #        proxy_pass http://127.0.0.1:8000;
  102.       proxy_pass http://192.168.122.137:8000;
  103.  
  104.     }
  105.  
  106.  
  107.     location ~ ^/landing/ {
  108.  
  109.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  110.       proxy_set_header X-Forwarded-Proto $scheme;
  111.       proxy_set_header Host $http_host;
  112.       proxy_redirect off;
  113.  
  114.  
  115. #      proxy_pass http://127.0.0.1:8000;
  116.       proxy_pass http://192.168.122.137:8000;
  117.  
  118.     }
  119.  
  120.     location /ws/ {
  121. #      proxy_pass http://127.0.0.1:8000;
  122.         proxy_pass http://192.168.122.137:8000;
  123.  
  124.       proxy_http_version 1.1;
  125.       proxy_set_header Upgrade $http_upgrade;
  126.       proxy_set_header Connection "upgrade";
  127.     }
  128.  
  129.  
  130.    
  131.     location / {
  132.         set $flag 0;
  133.     if (-f /etc/nginx/technical.works ) {
  134.         set $flag 1;
  135.     }
  136.     if ($host = 'www.develop.wikiworks.io' )  {
  137.         set $flag 0;
  138.     }
  139.     if ($host = 'develop.wikiworks.io' )  {
  140.         set $flag 0;
  141.     }
  142.    
  143.     if ($flag = 1)  {
  144.         return 503;
  145.     }
  146.     if ($request_uri ~ technical_works.html)
  147.     {
  148.        set $flag "${flag}1";
  149.     }
  150.     if ($flag = "01")
  151.     {
  152.           rewrite ^ https://$host permanent;
  153.     }
  154.  
  155. #   proxy_set_header REMOTE_ADDR $proxy_add_x_forwarded_for;
  156. #   proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
  157. #        proxy_set_header Host $host;
  158. #        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  159. #        proxy_pass http://127.0.0.1:8000;
  160.  
  161.         root /srv/sites/develop/dist;
  162.             # try_files $uri $uri/index.html;
  163.         index index.html;
  164.             try_files $uri $uri/ /index.html;
  165.                
  166.     }
  167.    
  168.        location @zagl {
  169. #            set $fl 0;
  170.         if ($request_uri ~ /static-err/)
  171.             {
  172. #          rewrite ^/static-err/(.*)$ /static/$1 last;         
  173.             set $fl 0;
  174.             }
  175.             if ($request_uri ~ technical_works.html)
  176.         {  
  177.             set $fl 0;
  178.         }
  179.               if ($fl != 0)
  180.               {
  181.                   rewrite ^ https://$host/technical_works.html break;
  182.               }
  183.               proxy_pass http://127.0.0.1:9999;
  184.              
  185.     }
  186.                  
  187. }
  188.  
  189.  
  190. server {
  191.  
  192.     # Server
  193.     listen          443 ssl http2;
  194. #    listen             80;
  195.  
  196.     server_name                 develop.wikiworks.io www.develop.wikiworks.io;
  197.     server_name_in_redirect     off;
  198. #    ssl_certificate         /etc/nginx/ssl/wikiworks.crt;
  199. #    ssl_certificate_key     /etc/nginx/ssl/wikiworks.key;
  200.     ssl_certificate /etc/letsencrypt/live/develop.wikiworks.io/fullchain.pem; # managed by Certbot
  201.     ssl_certificate_key /etc/letsencrypt/live/develop.wikiworks.io/privkey.pem; # managed by Certbot
  202.  
  203. #    root /srv/sites/wp.wikiworks.io/www/wp;
  204.  
  205.     auth_basic           "closed site";
  206.     auth_basic_user_file passwdldap;
  207.     satisfy any;
  208.     allow 127.0.0.1;
  209.     allow 192.168.0.0/16;
  210.     deny all;
  211.  
  212.     error_page 502 = @zagl;
  213.     error_page 503 = @zagl;
  214.    
  215.  
  216.     if ($host = 'www.develop.wikiworks.io') {
  217.         return 301 https://develop.wikiworks.io$request_uri;
  218.     }
  219.     if ($scheme = http) {
  220.         return 301 https://$host$request_uri;
  221.     }
  222.  
  223.     client_max_body_size        6144M;
  224.     client_body_buffer_size     4M;
  225.  
  226.     access_log /var/log/nginx/develop.wikiworks_main_access_log;
  227.     error_log /var/log/nginx/develop.wikiworks_main_error_log;
  228.  
  229.     # Proxy
  230.     proxy_set_header    X-Real-IP $remote_addr;
  231.     proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
  232.     proxy_set_header    Host $host;
  233.     proxy_set_header    X-Forwarded-Proto https;
  234.  
  235. #   location /ru
  236. #        {
  237. #   rewrite    /ru/(.*) /$1 break;
  238. #        proxy_set_header X-Real-IP  $remote_addr;
  239. #        proxy_set_header Host wikiworks.ru;
  240. #        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  241. #        proxy_pass http://127.0.0.1:8008;
  242. #   }
  243.                    
  244.  
  245.     location / {
  246.     proxy_set_header X-Real-IP  $remote_addr;
  247.         proxy_set_header Host $host;
  248.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  249. #        proxy_pass http://127.0.0.1:8009;
  250.         proxy_pass http://192.168.122.137:8080;
  251.     }
  252.    
  253.        location @zagl {
  254.               proxy_pass http://127.0.0.1:9998;
  255.     }
  256.  
  257.    
  258.  
  259. }
  260.  
  261. server {
  262.     listen  443 ssl http2;
  263. #    listen 80;
  264.     server_name *.develop.wikiworks.io;
  265.     charset     utf-8;
  266. #    ssl_certificate         /etc/nginx/ssl/wikiworks.crt;
  267. #    ssl_certificate_key     /etc/nginx/ssl/wikiworks.key;
  268.     ssl_certificate         /etc/letsencrypt/live/stage.wikiworks.io/fullchain.pem;
  269.     ssl_certificate_key     /etc/letsencrypt/live/stage.wikiworks.io/privkey.pem;
  270.  
  271.  
  272.  
  273.     error_page 502 @zagl;
  274.     error_page 503 @zagl;
  275.     error_page 302 @zagl;
  276.  
  277.     location /static-err/
  278.     {
  279.           proxy_pass http://127.0.0.1:9999;
  280.     }
  281.  
  282.     access_log /var/log/nginx/wikiworks_main_access_log;
  283.     error_log /var/log/nginx/wikiworks_main_error_log;
  284.  
  285.     if ($scheme = http) {
  286.         return 301 https://$host$request_uri;
  287.     }
  288.  
  289.     client_max_body_size        6144M;
  290.     client_body_buffer_size     4M;
  291.  
  292.     proxy_connect_timeout       600;
  293.     proxy_send_timeout          600;
  294.     proxy_read_timeout          600;
  295.     send_timeout                600;
  296.     uwsgi_read_timeout          600;
  297.  
  298.    location ~ ^/api/v1/ {
  299.  
  300.  
  301.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  302.       proxy_set_header X-Forwarded-Proto $scheme;
  303.       proxy_set_header Host $http_host;
  304.       proxy_redirect off;
  305.  
  306.  
  307. #      proxy_pass http://127.0.0.1:8000;
  308.       proxy_pass http://192.168.122.137:8000;
  309.  
  310.     }
  311.    
  312.     location ~ ^/download/ {
  313.  
  314.  
  315.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  316.       proxy_set_header X-Forwarded-Proto $scheme;
  317.       proxy_set_header Host $http_host;
  318.       proxy_redirect off;
  319.  
  320.  
  321. #      proxy_pass http://127.0.0.1:8000;
  322.       proxy_pass http://192.168.122.137:8000;
  323.  
  324.     }
  325.  
  326.     location ~ ^/media/ {
  327.  
  328.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  329.       proxy_set_header X-Forwarded-Proto $scheme;
  330.       proxy_set_header Host $http_host;
  331.       proxy_redirect off;
  332.  
  333.  
  334. #      proxy_pass http://127.0.0.1:8000;
  335.       proxy_pass http://192.168.122.137:8000;
  336.  
  337.     }
  338.  
  339.     location ~ ^/django_query_profiler/ {
  340.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  341.         proxy_set_header X-Forwarded-Proto $scheme;
  342.     proxy_set_header Host $http_host;
  343.         proxy_redirect off;
  344.  
  345. #        proxy_pass http://127.0.0.1:8000;
  346.       proxy_pass http://192.168.122.137:8000;
  347.  
  348.     }
  349.  
  350.  
  351.     location ~ ^/landing/ {
  352.  
  353.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  354.       proxy_set_header X-Forwarded-Proto $scheme;
  355.       proxy_set_header Host $http_host;
  356.       proxy_redirect off;
  357.  
  358.  
  359. #      proxy_pass http://127.0.0.1:8000;
  360.       proxy_pass http://192.168.122.137:8000;
  361.  
  362.     }
  363.  
  364.     location /ws/ {
  365. #      proxy_pass http://127.0.0.1:8000;
  366.         proxy_pass http://192.168.122.137:8000;
  367.  
  368.       proxy_http_version 1.1;
  369.       proxy_set_header Upgrade $http_upgrade;
  370.       proxy_set_header Connection "upgrade";
  371.     }
  372.  
  373.     location ~ ^/js/ {
  374.  
  375.         root /srv/sites/stage/dist;
  376.             # try_files $uri $uri/index.html;
  377.         index index.html;
  378.             try_files $uri $uri/ /index.html;
  379.  
  380.  
  381.  
  382.     }
  383.  
  384.    
  385.     location / {
  386.  
  387. #    auth_basic           "closed site";
  388. #    auth_basic_user_file passwdldap;
  389. #    satisfy any;
  390. #    allow 127.0.0.1;
  391. #    allow 192.168.0.0/16;
  392. #    deny all;
  393.  
  394.         set $flag 0;
  395.     if (-f /etc/nginx/technical.works ) {
  396.         set $flag 1;
  397.     }
  398.     if ($host = 'www.develop.wikiworks.io' )  {
  399.         set $flag 0;
  400.     }
  401.     if ($host = 'develop.wikiworks.io' )  {
  402.         set $flag 0;
  403.     }
  404.    
  405.     if ($flag = 1)  {
  406.         return 503;
  407.     }
  408.     if ($request_uri ~ technical_works.html)
  409.     {
  410.        set $flag "${flag}1";
  411.     }
  412.     if ($flag = "01")
  413.     {
  414.           rewrite ^ https://$host permanent;
  415.     }
  416.  
  417. #   proxy_set_header REMOTE_ADDR $proxy_add_x_forwarded_for;
  418. #   proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
  419. #        proxy_set_header Host $host;
  420. #        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  421. #        proxy_pass http://127.0.0.1:8000;
  422.  
  423.         root /srv/sites/develop/dist;
  424.             # try_files $uri $uri/index.html;
  425.         index index.html;
  426.             try_files $uri $uri/ /index.html;
  427.                
  428.     }
  429.    
  430.        location @zagl {
  431. #            set $fl 0;
  432.         if ($request_uri ~ /static-err/)
  433.             {
  434. #          rewrite ^/static-err/(.*)$ /static/$1 last;         
  435.             set $fl 0;
  436.             }
  437.             if ($request_uri ~ technical_works.html)
  438.         {  
  439.             set $fl 0;
  440.         }
  441.               if ($fl != 0)
  442.               {
  443.                   rewrite ^ https://$host/technical_works.html break;
  444.               }
  445.               proxy_pass http://127.0.0.1:9999;
  446.              
  447.     }
  448.                  
  449. }
  450.  
  451.  
  452.  
  453. server {
  454.     listen  443 ssl http2;
  455. #    listen 80;
  456.  
  457.     server_name admin.develop.wikiworks.io;
  458.     charset     utf-8;
  459. #    ssl_certificate         /etc/nginx/ssl/wikiworks.crt;
  460. #    ssl_certificate_key     /etc/nginx/ssl/wikiworks.key;
  461.     ssl_certificate         /etc/letsencrypt/live/stage.wikiworks.io/fullchain.pem;
  462.     ssl_certificate_key     /etc/letsencrypt/live/stage.wikiworks.io/privkey.pem;
  463.  
  464.     error_page 502 @zagl;
  465.     error_page 503 @zagl;
  466.     error_page 302 @zagl;
  467.  
  468.     location /static-err/
  469.     {
  470.           proxy_pass http://127.0.0.1:9999;
  471.     }
  472.  
  473.  
  474.  
  475.     access_log /var/log/nginx/wikiworks_main_access_log;
  476.     error_log /var/log/nginx/wikiworks_main_error_log;
  477.  
  478.     if ($scheme = http) {
  479.         return 301 https://$host$request_uri;
  480.     }
  481.  
  482.     client_max_body_size        6144M;
  483.     client_body_buffer_size     4M;
  484.  
  485.     # Proxy
  486. #    proxy_set_header REMOTE_ADDR $remote_addr;
  487. #    proxy_set_header    X-Real-IP $proxy_add_x_forwarded_for;
  488. #    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
  489. #    proxy_set_header    Host $host;
  490.  
  491.     proxy_connect_timeout       600;
  492.     proxy_send_timeout          600;
  493.     proxy_read_timeout          600;
  494.     send_timeout                600;
  495.     uwsgi_read_timeout          600;
  496.    
  497.     location /landing
  498.     {
  499. #        auth_basic "Unauthorized";
  500. #        auth_basic_user_file /etc/nginx/htpasswd;
  501. #   satisfy any;
  502. #   allow 192.168.0.0/16;
  503. #   allow 172.16.0.0/12;
  504. #   allow 127.0.0.0/8;
  505. #   allow 5.166.101.190;
  506.  
  507.  
  508.     proxy_set_header REMOTE_ADDR $proxy_add_x_forwarded_for;
  509.     proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
  510.         proxy_set_header Host $host;
  511.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  512. #        proxy_pass http://127.0.0.1:8000;
  513.       proxy_pass http://192.168.122.137:8000;
  514.  
  515.     }
  516.  
  517.     location ~ ^/django_query_profiler/ {
  518.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  519.         proxy_set_header X-Forwarded-Proto $scheme;
  520.     proxy_set_header Host $http_host;
  521.         proxy_redirect off;
  522.  
  523. #        proxy_pass http://127.0.0.1:8000;
  524.       proxy_pass http://192.168.122.137:8000;
  525.  
  526.     }
  527.  
  528.  
  529.  
  530.  
  531.    
  532.     location / {
  533.         set $flag 0;
  534.     if (-f /etc/nginx/technical.works ) {
  535.         set $flag 1;
  536.     }
  537.     if ($host = 'www.develop.wikiworks.io' )  {
  538.         set $flag 0;
  539.     }
  540.     if ($host = 'develop.wikiworks.io' )  {
  541.         set $flag 0;
  542.     }
  543.    
  544.     if ($flag = 1)  {
  545.         return 503;
  546.     }
  547.     if ($request_uri ~ technical_works.html)
  548.     {
  549.        set $flag "${flag}1";
  550.     }
  551.     if ($flag = "01")
  552.     {
  553.           rewrite ^ https://$host permanent;
  554.     }
  555.  
  556. #                proxy_cache all;
  557. #                proxy_cache_valid any 1h;
  558.                                
  559.  
  560.     proxy_set_header REMOTE_ADDR $proxy_add_x_forwarded_for;
  561.     proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
  562.         proxy_set_header Host $host;
  563.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  564. #        proxy_pass http://127.0.0.1:8000;
  565.       proxy_pass http://192.168.122.137:8000;
  566.  
  567.     }
  568.    
  569.        location @zagl {
  570. #            set $fl 0;
  571.         if ($request_uri ~ /static-err/)
  572.             {
  573. #          rewrite ^/static-err/(.*)$ /static/$1 last;         
  574.             set $fl 0;
  575.             }
  576.             if ($request_uri ~ technical_works.html)
  577.         {  
  578.             set $fl 0;
  579.         }
  580.               if ($fl != 0)
  581.               {
  582.                   rewrite ^ https://$host/technical_works.html break;
  583.               }
  584.               proxy_pass http://127.0.0.1:9999;
  585.              
  586.     }
  587.                  
  588. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement