index.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!doctype html>
  2. <head>
  3. <title>CodeMirror: NGINX mode</title>
  4. <meta charset="utf-8"/>
  5. <link rel=stylesheet href="../../doc/docs.css">
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="nginx.js"></script>
  9. <style>.CodeMirror {background: #f8f8f8;}</style>
  10. <link rel="stylesheet" href="../../doc/docs.css">
  11. </head>
  12. <style>
  13. body {
  14. margin: 0em auto;
  15. }
  16. .CodeMirror, .CodeMirror-scroll {
  17. height: 600px;
  18. }
  19. </style>
  20. <div id=nav>
  21. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  22. <ul>
  23. <li><a href="../../index.html">Home</a>
  24. <li><a href="../../doc/manual.html">Manual</a>
  25. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  26. </ul>
  27. <ul>
  28. <li><a href="../index.html">Language modes</a>
  29. <li><a class=active href="#">NGINX</a>
  30. </ul>
  31. </div>
  32. <article>
  33. <h2>NGINX mode</h2>
  34. <form><textarea id="code" name="code" style="height: 800px;">
  35. server {
  36. listen 173.255.219.235:80;
  37. server_name website.com.au;
  38. rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
  39. }
  40. server {
  41. listen 173.255.219.235:443;
  42. server_name website.com.au;
  43. rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
  44. }
  45. server {
  46. listen 173.255.219.235:80;
  47. server_name www.website.com.au;
  48. root /data/www;
  49. index index.html index.php;
  50. location / {
  51. index index.html index.php; ## Allow a static html file to be shown first
  52. try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
  53. expires 30d; ## Assume all files are cachable
  54. }
  55. ## These locations would be hidden by .htaccess normally
  56. location /app/ { deny all; }
  57. location /includes/ { deny all; }
  58. location /lib/ { deny all; }
  59. location /media/downloadable/ { deny all; }
  60. location /pkginfo/ { deny all; }
  61. location /report/config.xml { deny all; }
  62. location /var/ { deny all; }
  63. location /var/export/ { ## Allow admins only to view export folder
  64. auth_basic "Restricted"; ## Message shown in login window
  65. auth_basic_user_file /rs/passwords/testfile; ## See /etc/nginx/htpassword
  66. autoindex on;
  67. }
  68. location /. { ## Disable .htaccess and other hidden files
  69. return 404;
  70. }
  71. location @handler { ## Magento uses a common front handler
  72. rewrite / /index.php;
  73. }
  74. location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
  75. rewrite ^/(.*.php)/ /$1 last;
  76. }
  77. location ~ \.php$ {
  78. if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
  79. fastcgi_pass 127.0.0.1:9000;
  80. fastcgi_index index.php;
  81. fastcgi_param PATH_INFO $fastcgi_script_name;
  82. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  83. include /rs/confs/nginx/fastcgi_params;
  84. }
  85. }
  86. server {
  87. listen 173.255.219.235:443;
  88. server_name website.com.au www.website.com.au;
  89. root /data/www;
  90. index index.html index.php;
  91. ssl on;
  92. ssl_certificate /rs/ssl/ssl.crt;
  93. ssl_certificate_key /rs/ssl/ssl.key;
  94. ssl_session_timeout 5m;
  95. ssl_protocols SSLv2 SSLv3 TLSv1;
  96. ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  97. ssl_prefer_server_ciphers on;
  98. location / {
  99. index index.html index.php; ## Allow a static html file to be shown first
  100. try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
  101. expires 30d; ## Assume all files are cachable
  102. }
  103. ## These locations would be hidden by .htaccess normally
  104. location /app/ { deny all; }
  105. location /includes/ { deny all; }
  106. location /lib/ { deny all; }
  107. location /media/downloadable/ { deny all; }
  108. location /pkginfo/ { deny all; }
  109. location /report/config.xml { deny all; }
  110. location /var/ { deny all; }
  111. location /var/export/ { ## Allow admins only to view export folder
  112. auth_basic "Restricted"; ## Message shown in login window
  113. auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
  114. autoindex on;
  115. }
  116. location /. { ## Disable .htaccess and other hidden files
  117. return 404;
  118. }
  119. location @handler { ## Magento uses a common front handler
  120. rewrite / /index.php;
  121. }
  122. location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
  123. rewrite ^/(.*.php)/ /$1 last;
  124. }
  125. location ~ .php$ { ## Execute PHP scripts
  126. if (!-e $request_filename) { rewrite /index.php last; } ## Catch 404s that try_files miss
  127. fastcgi_pass 127.0.0.1:9000;
  128. fastcgi_index index.php;
  129. fastcgi_param PATH_INFO $fastcgi_script_name;
  130. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  131. include /rs/confs/nginx/fastcgi_params;
  132. fastcgi_param HTTPS on;
  133. }
  134. }
  135. </textarea></form>
  136. <script>
  137. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
  138. </script>
  139. <p><strong>MIME types defined:</strong> <code>text/nginx</code>.</p>
  140. </article>