server_snippet_nginx.rb 694 B

123456789101112131415161718192021222324252627
  1. class KnowledgeBase
  2. class ServerSnippetNginx < ServerSnippet
  3. def template_path
  4. <<-ERB.strip_heredoc
  5. # Add following lines to "server" directive
  6. rewrite ^#{path}(.*)$ /help$1 last;
  7. ERB
  8. end
  9. def template_full
  10. <<-ERB.strip_heredoc
  11. # Add following lines to "server" directive
  12. if ($host = #{host} ) {
  13. rewrite ^/(api|assets)/(.*)$ /$1/$2 last;
  14. rewrite ^#{path}(.*)$ /help$1 last;
  15. }
  16. ERB
  17. end
  18. def template_original_url
  19. <<-ERB.strip_heredoc
  20. # Add following line to "Location /" directive, before other proxy_set_header
  21. proxy_set_header X-ORIGINAL-URL $request_uri;
  22. ERB
  23. end
  24. end
  25. end