Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. server {
  2.  
  3. listen 80;
  4. server_name images4.gameru.net;
  5. return 301 https://$server_name$request_uri;
  6. }
  7.  
  8. server {
  9.  
  10. listen 443;
  11. server_name images4.gameru.net;
  12. root /home/1001v/web/images;
  13.  
  14. location / {
  15.  
  16. location ~/thumb/(?<ch1>\w)(?<ch2>\w)(?<ch3>\w+).(?<ch4>\w+) {
  17.  
  18. root /home/1001v/web/api/images;
  19. try_files /$ch1/$ch2/th_$ch1$ch2$ch3.$ch4 @404;
  20. }
  21.  
  22. location ~/image/thumb/(?<ch1>\w)/(?<ch2>\w)(?<ch3>\w)(?<ch4>\w+).(?<ch5>\w+) {
  23.  
  24. root /home/1001v/web/api/images;
  25. try_files /$ch2/$ch3/th_${ch1}_$ch2$ch3$ch4.$ch5 @generate;
  26. }
  27.  
  28.  
  29. location ~/image/direct/(?<ch1>\w)(?<ch2>\w)(?<ch3>\w+).(?<ch4>\w+) {
  30.  
  31. proxy_pass http://localhost:5555;
  32. proxy_http_version 1.1;
  33. proxy_set_header Upgrade $http_upgrade;
  34. proxy_set_header Connection 'upgrade';
  35. proxy_set_header Host $host;
  36. proxy_set_header X-Real-IP $remote_addr;
  37. proxy_set_header X-Forwarded-Proto $scheme;
  38. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  39. proxy_cache_bypass $http_upgrade;
  40. error_page 502 = @502;
  41. }
  42.  
  43.  
  44. gzip_static on;
  45. try_files $uri $uri/index.html @rewrites;
  46. }
  47.  
  48. location @generate {
  49.  
  50. proxy_pass http://localhost:5555;
  51. proxy_http_version 1.1;
  52. proxy_set_header Upgrade $http_upgrade;
  53. proxy_set_header Connection 'upgrade';
  54. proxy_set_header Host $host;
  55. proxy_set_header X-Real-IP $remote_addr;
  56. proxy_set_header X-Forwarded-Proto $scheme;
  57. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  58. proxy_cache_bypass $http_upgrade;
  59. error_page 502 = @404;
  60. }
  61.  
  62.  
  63. location @rewrites {
  64.  
  65. rewrite ^(.+)$ /index.html last;
  66. }
  67. location @502 {
  68.  
  69. root /home/1001v/web/api/images;
  70. try_files /$ch1/$ch2/$ch1$ch2$ch3.$ch4 @404;
  71. }
  72.  
  73.  
  74. location @404 {
  75.  
  76. root /home/1001v/web/api/resources/images;
  77. try_files /404.jpg =404;
  78.  
  79. }
  80. location @500 {
  81.  
  82. root /home/1001v/web/api/resources/images;
  83. try_files /503.jpg =500;
  84. }
  85.  
  86. location /error/ {
  87.  
  88. alias /home/1001v/web/document_errors/;
  89. }
  90.  
  91. location ~ /\.ht {
  92.  
  93. return 404
  94. }
  95. location ~ /\.svn/ {
  96.  
  97. return 404
  98. }
  99. location ~ /\.git/ {
  100.  
  101. return 404
  102. }
  103. location ~ /\.hg/ {
  104.  
  105. return 404
  106. }
  107. location ~ /\.bzr/ {
  108.  
  109. return 404
  110. }
  111. ssl_certificate /etc/letsencrypt/live/images4.gameru.net/fullchain.pem; # managed by Certbot
  112. ssl_certificate_key /etc/letsencrypt/live/images4.gameru.net/privkey.pem; # managed by Certbot
  113.  
  114.  
  115. }
  116.  
  117. server {
  118.  
  119. listen 80;
  120. server_name api.gameru.net;
  121. return 301 https://$server_name$request_uri;
  122. }
  123.  
  124. server {
  125.  
  126. listen 443;
  127.  
  128. server_name api.gameru.net;
  129.  
  130. location / {
  131.  
  132. proxy_pass http://localhost:5555;
  133. proxy_http_version 1.1;
  134. proxy_set_header Upgrade $http_upgrade;
  135. proxy_set_header Connection 'upgrade';
  136. proxy_set_header Host $host;
  137. proxy_set_header X-Real-IP $remote_addr;
  138. proxy_set_header X-Forwarded-Proto $scheme;
  139. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  140. proxy_cache_bypass $http_upgrade;
  141. }
  142. ssl_certificate /etc/letsencrypt/live/api.gameru.net/fullchain.pem; # managed by Certbot
  143. ssl_certificate_key /etc/letsencrypt/live/api.gameru.net/privkey.pem; # managed by Certbot
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement