1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2008 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 NGINX Web Server Management Control
8 Ofer Chen (roadkill AT tomatoraf dot com)
9 Vicente Soriano (victek AT tomatoraf dot com)
10 Copyright (C) 2013 http://www.tomatoraf.com
12 For use with Tomato Firmware only.
13 No part of this file can be used or modified without permission.
17 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
18 <meta name='robots' content='noindex,nofollow'
>
19 <title>[<%
ident(); %>] Web Server Menu
</title>
20 <link rel='stylesheet' type='text/css' href='tomato.css'
>
21 <link rel='stylesheet' type='text/css' href='color.css'
>
22 <script type='text/javascript' src='tomato.js'
></script>
26 <style type='text/css'
>
33 <script type='text/javascript'
>
35 // <% nvram("nginx_enable,nginx_php,nginx_keepconf,nginx_port,nginx_fqdn,nginx_docroot,nginx_priority,nginx_custom,nginx_user"); %>
38 nginxup
= parseInt ('<% psup("nginx"); %>');
40 function toggle(service
, isup
)
43 if (!confirm("Unsaved changes will be lost. Continue anyway?")) return;
45 E('_' + service
+ '_button').disabled
= true;
46 form
.submitHidden('/service.cgi', {
47 _redirect
: 'nginx.asp',
48 _sleep
: ((service
== 'nginxfp') && (!isup
)) ? '10' : '5',
49 _service
: service
+ (isup
? '-stop' : '-start')
53 function verifyFields(focused
, quiet
)
62 _f_nginx_keepconf
: 1,
65 _f_nginx_priority
: 1,
68 if (!E('_f_nginx_enable').checked
) {
72 vis
._f_nginx_enable
= 1;
75 if (!v_port('_f_nginx_port', quiet
))
81 if ((!v_length('_f_nginx_docroot', quiet
, 1, 255)) || (!v_length('_f_nginx_fqdn', quiet
, 1, 255)) || (!v_length('_f_nginx_custom', quiet
, 1, 4096)))
94 if (!verifyFields(null, false)) return;
96 fom
.nginx_enable
.value
= E('_f_nginx_enable').checked
? 1 : 0;
97 if (fom
.nginx_enable
.value
) {
98 fom
.nginx_php
.value
= fom
.f_nginx_php
.checked
? 1 : 0;
99 fom
.nginx_keepconf
.value
= fom
.f_nginx_keepconf
.checked
? 1 : 0;
100 fom
.nginx_port
.value
= fom
.f_nginx_port
.value
;
101 fom
.nginx_fqdn
.value
= fom
.f_nginx_fqdn
.value
;
102 fom
.nginx_docroot
.value
= fom
.f_nginx_docroot
.value
;
103 fom
.nginx_priority
.value
= fom
.f_nginx_priority
.value
;
104 fom
.nginx_custom
.value
= fom
.f_nginx_custom
.value
;
105 fom
._service
.value
= 'nginx-restart';
107 fom
._service
.value
= 'nginx-stop';
114 verifyFields(null, 1);
118 <body onLoad=
"init()">
119 <table id='container' cellspacing=
0>
120 <tr><td colspan=
2 id='header'
>
121 <div class='title'
>Tomato
</div>
122 <div class='version'
>Version <%
version(); %></div>
124 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
126 <div id='ident'
><%
ident(); %></div>
129 <div class='section-title'
>Status
</div>
130 <div class='section' id='status-section'
>
131 <script type='text/javascript'
>
132 W('NGINX is currently '+(!nginxup
? 'stopped' : 'running')+' ');
133 W('<input type="button" value="' + (nginxup
? 'Stop' : 'Start') + ' Now" onclick="toggle(\'nginxfp\', nginxup)" id="_nginxfp_button">');
139 <div class='section-title'
>WEB Server Settings
</div>
140 <div class='section' id='config-section'
>
141 <form id='_fom' method='post' action='tomato.cgi'
>
142 <input type='hidden' name='_nextpage' value='nginx.asp'
>
143 <input type='hidden' name='_service' value='enginex-restart'
>
144 <input type='hidden' name='_nextwait' value='
10'
>
145 <input type='hidden' name='_reboot' value='
0'
>
147 <input type='hidden' name='nginx_enable'
>
148 <input type='hidden' name='nginx_php'
>
149 <input type='hidden' name='nginx_keepconf'
>
150 <input type='hidden' name='nginx_port'
>
151 <input type='hidden' name='nginx_fqdn'
>
152 <input type='hidden' name='nginx_docroot'
>
153 <input type='hidden' name='nginx_priority'
>
154 <input type='hidden' name='nginx_custom'
>
156 <script type='text/javascript'
>
157 createFieldTable('', [
158 { title
: 'Enable Server on Start', name
: 'f_nginx_enable', type
: 'checkbox', value
: nvram
.nginx_enable
== '1'},
159 { title
: 'Enable PHP support', name
: 'f_nginx_php', type
: 'checkbox', value
: (nvram
.nginx_php
!= '0') },
160 { title
: 'Run As', name
: 'nginx_user', type
: 'select',
161 options
: [['root','Root'],['nobody','Nobody']], value
: nvram
.nginx_user
},
162 { title
: 'Keep Config Files', name
: 'f_nginx_keepconf', type
: 'checkbox', value
: (nvram
.nginx_keepconf
!= '0') },
163 { title
: 'Web Server Port', name
: 'f_nginx_port', type
: 'text', maxlen
: 5, size
: 7, value
: fixPort(nvram
.nginx_port
, 85), suffix
: '<small> default: 85</small>' },
164 { title
: 'Web Server Name', name
: 'f_nginx_fqdn', type
: 'text', maxlen
: 255, size
: 20, value
: nvram
.nginx_fqdn
},
165 { title
: 'Server Root Path', name
: 'f_nginx_docroot', type
: 'text', maxlen
: 255, size
: 40, value
: nvram
.nginx_docroot
, suffix
: '<span> /index.html / index.htm / index.php</span>' },
166 { title
: 'Server Priority', name
: 'f_nginx_priority', type
: 'text', maxlen
: 8, size
:3, value
: nvram
.nginx_priority
, suffix
:'<small> Max. Perfor: -20, Min.Perfor: 19, default: 10</small>' },
167 { title
: '<a href="http://wiki.nginx.org/Configuration" target="_new">NGINX</a><br>Custom configuration', name
: 'f_nginx_custom', type
: 'textarea', value
: nvram
.nginx_custom
}
175 <span style='color:blue'
>
176 <b>User Manual.
</b><br>
179 <li><b> Status Button:
</b> Quick Start-Stop Service. Enable Web Server must be checked to modify settings.
<br>
180 <li><b> Enable Server on Start:
</b> To activate the Web Server tick and save this screen.
<br>
181 <li><b> Enable PHP support:
</b> To activate the PHP support (php-cgi) tick and save this screen.
<br>
182 <li><b> Run As:
</b> Select user used to start nginx and php-cgi daemon.
<br>
183 <li><b> Keep Config Files:
</b> Have you modified the configuration file manually? Tick this box and changes will be maintained.
<br>
184 <li><b> Web Server Port:
</b> The Port used by the Web Server to be accessed. Check conflict when the port is used by other services.
<br>
185 <li><b> Web Server Name:
</b> Name that will appear on top of your Internet Browser.
<br>
186 <li><b> Document Root Path:
</b> The path in your router where documents are stored.
<br>
187 <li><b> Examples:
<br></b>
188 /tmp/mnt/HDD/www/ as you can find in USB mount path.
<br>
189 <li><b> NGINX Custom Configuration:
</b> You can add other values to nginx.conf to suit your needs.
<br>
191 <span style='color:blue'
>
192 <li><b> Server Priority:
</b> Sets the service priority over other processes running on the router.
<br><br>
193 The operating system kernel has priority -
5.
<br>
194 Never select a lower value than the kernel uses. Do not use the service test page to adjust the
<br>
195 server performance, it's performance is lower than the definitive media where files will be
<br>
196 located, i.e; USB Stick, Hard Drive or SSD.
<br>
204 <tr><td id='footer' colspan=
2>
205 <span id='footer-msg'
></span>
206 <input type='button' value='Save' id='save-button' onclick='save()'
>
207 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'
>
211 <script type='text/javascript'
>verifyFields(null, 1);</script>