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