You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
5.1 KiB

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