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_upload,nginx_remote,nginx_fqdn,nginx_docroot,nginx_priority,nginx_custom,nginx_httpcustom,nginx_servercustom,nginx_user,nginx_phpconf,nginx_override,nginx_overridefile"); %>
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
)
57 var a
= E('_f_nginx_enable').checked
;
58 var b
= E('_f_nginx_override').checked
;
60 E('_f_nginx_php').disabled
= !a
;
61 E('_f_nginx_keepconf').disabled
= !a
|| b
;
62 E('_nginx_port').disabled
= !a
|| b
;
63 E('_nginx_upload').disabled
= !a
|| b
;
64 E('_f_nginx_remote').disabled
= !a
;
65 E('_nginx_fqdn').disabled
= !a
|| b
;
66 E('_nginx_docroot').disabled
= !a
|| b
;
67 E('_nginx_priority').disabled
= !a
|| b
;
68 E('_nginx_custom').disabled
= !a
|| b
;
69 E('_nginx_httpcustom').disabled
= !a
|| b
;
70 E('_nginx_servercustom').disabled
= !a
|| b
;
71 E('_nginx_user').disabled
= !a
;
72 E('_nginx_phpconf').disabled
= !a
|| b
;
73 E('_f_nginx_override').disabled
= !a
;
74 E('_nginx_overridefile').disabled
= !a
|| !b
;
81 if (verifyFields(null, 0)==0) return;
84 fom
.nginx_enable
.value
= E('_f_nginx_enable').checked
? 1 : 0;
85 if (fom
.nginx_enable
.value
) {
86 fom
.nginx_php
.value
= fom
.f_nginx_php
.checked
? 1 : 0;
87 fom
.nginx_keepconf
.value
= fom
.f_nginx_keepconf
.checked
? 1 : 0;
88 fom
.nginx_remote
.value
= fom
.f_nginx_remote
.checked
? 1 : 0;
89 fom
.nginx_override
.value
= fom
.f_nginx_override
.checked
? 1 : 0;
90 fom
._service
.value
= 'nginx-restart';
92 fom
._service
.value
= 'nginx-stop';
99 verifyFields(null, 1);
103 <body onLoad=
"init()">
104 <table id='container' cellspacing=
0>
105 <tr><td colspan=
2 id='header'
>
106 <div class='title'
>Tomato
</div>
107 <div class='version'
>Version <%
version(); %></div>
109 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
111 <div id='ident'
><%
ident(); %></div>
114 <div class='section-title'
>Status
</div>
115 <div class='section' id='status-section'
>
116 <script type='text/javascript'
>
117 W('NGINX is currently '+(!nginxup
? 'stopped' : 'running')+' ');
118 W('<input type="button" value="' + (nginxup
? 'Stop' : 'Start') + ' Now" onclick="toggle(\'nginxfp\', nginxup)" id="_nginxfp_button">');
123 <div class='section-title'
>Basic Settings
</div>
124 <div class='section' id='config-section'
>
125 <form id='_fom' method='post' action='tomato.cgi'
>
126 <input type='hidden' name='_nextpage' value='nginx.asp'
>
127 <input type='hidden' name='_service' value='enginex-restart'
>
128 <input type='hidden' name='_nextwait' value='
10'
>
129 <input type='hidden' name='_reboot' value='
0'
>
131 <input type='hidden' name='nginx_enable'
>
132 <input type='hidden' name='nginx_php'
>
133 <input type='hidden' name='nginx_keepconf'
>
134 <input type='hidden' name='nginx_remote'
>
135 <input type='hidden' name='nginx_override'
>
137 <script type='text/javascript'
>
138 createFieldTable('', [
139 { title
: 'Enable Server on Start', name
: 'f_nginx_enable', type
: 'checkbox', value
: nvram
.nginx_enable
== '1'},
140 { title
: 'Enable PHP support', name
: 'f_nginx_php', type
: 'checkbox', value
: nvram
.nginx_php
== '1' },
141 { title
: 'Run As', name
: 'nginx_user', type
: 'select',
142 options
: [['root','Root'],['nobody','Nobody']], value
: nvram
.nginx_user
},
143 { title
: 'Keep Config Files', name
: 'f_nginx_keepconf', type
: 'checkbox', value
: nvram
.nginx_keepconf
== '1' },
144 { title
: 'Web Server Port', name
: 'nginx_port', type
: 'text', maxlen
: 5, size
: 7, value
: fixPort(nvram
.nginx_port
, 85), suffix
: '<small> default: 85</small>' },
145 { title
: 'Upload file size limit', name
: 'nginx_upload', type
: 'text', maxlen
: 5, size
: 7, value
: nvram
.nginx_upload
, suffix
: '<small> MB</small>'},
146 { title
: 'Allow Remote Access', name
: 'f_nginx_remote', type
: 'checkbox', value
: nvram
.nginx_remote
== '1' },
147 { title
: 'Web Server Name', name
: 'nginx_fqdn', type
: 'text', maxlen
: 255, size
: 20, value
: nvram
.nginx_fqdn
},
148 { title
: 'Server Root Path', name
: 'nginx_docroot', type
: 'text', maxlen
: 255, size
: 40, value
: nvram
.nginx_docroot
, suffix
: '<small> /index.html / index.htm / index.php</small>' },
149 { title
: 'Server Priority', name
: 'nginx_priority', type
: 'text', maxlen
: 8, size
:3, value
: nvram
.nginx_priority
, suffix
:'<small> Max. Perfor: -20, Min.Perfor: 19, default: 10</small>' }
153 <div class='section-title'
>Advanced Settings
</div>
154 <div class='section'
>
155 <script type='text/javascript'
>
156 createFieldTable('', [
157 { title
: '<a href="http://wiki.nginx.org/Configuration" target="_new">NGINX</a><br>HTTP Section<br>Custom configuration', name
: 'nginx_httpcustom', type
: 'textarea', value
: nvram
.nginx_httpcustom
},
158 { title
: '<a href="http://wiki.nginx.org/Configuration" target="_new">NGINX</a><br>SERVER Section<br>Custom configuration', name
: 'nginx_servercustom', type
: 'textarea', value
: nvram
.nginx_servercustom
},
159 { title
: '<a href="http://wiki.nginx.org/Configuration" target="_new">NGINX</a><br>Custom configuration', name
: 'nginx_custom', type
: 'textarea', value
: nvram
.nginx_custom
},
160 { title
: '<a href="http://php.net/manual/en/ini.php" target="_new">PHP</a><br>Custom configuration', name
: 'nginx_phpconf', type
: 'textarea', value
: nvram
.nginx_phpconf
},
162 { title
: 'Use user config file', name
: 'f_nginx_override', type
: 'checkbox', value
: nvram
.nginx_override
== '1', suffix
: '<small> User config file will be used, some of GUI settings will be ignored</small>' },
163 { title
: 'User config file path', name
: 'nginx_overridefile', type
: 'text', maxlen
: 255, size
: 40, value
: nvram
.nginx_overridefile
}
167 <div class='section-title'
>Notes
</div>
168 <div class='section'
>
170 <li><b> Status Button:
</b> Quick Start-Stop Service. Enable Web Server must be checked to modify settings.
<br>
171 <li><b> Enable Server on Start:
</b> To activate the Web Server tick and save this screen.
<br>
172 <li><b> Enable PHP support:
</b> To activate the PHP support (php-cgi) tick and save this screen.
<br>
173 <li><b> Run As:
</b> Select user used to start nginx and php-cgi daemon.
<br>
174 <li><b> Keep Config Files:
</b> Have you modified the configuration file manually? Tick this box and changes will be maintained.
<br>
175 <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>
176 <li><b> Allow remote access:
</b> This option will open the Web Server GUI port from the WAN side. Service will be accessed from the internet.
<br>
177 <li><b> Web Server Name:
</b> Name that will appear on top of your Internet Browser.
<br>0
178 <li><b> Document Root Path:
</b> The path in your router where documents are stored.
<br>
179 <li><b> Examples:
<br></b>
180 /tmp/mnt/HDD/www as you can find in USB mount path.
<br>
181 <li><b> NGINX Custom Configuration:
</b> You can add other values to nginx.conf to suit your needs.
<br>
182 <li><b> NGINX HTTP Section Custom Configuration:
</b> You can add other values to nginx.conf in declaration of http {} to suit your needs.
<br>
183 <li><b> NGINX SERVER Section Custom Configuration:
</b> You can add other values to nginx.conf in declaration of server {} to suit your needs.
<br>
184 <li><b> PHP Custom Configuration:
</b> You can add other values to php.ini to suit your needs.
<br>
185 <li><b> Server Priority:
</b> Sets the service priority over other processes running on the router.
<br><br>
186 The operating system kernel has priority -
5.
<br>
187 Never select a lower value than the kernel uses. Do not use the service test page to adjust the
<br>
188 server performance, it's performance is lower than the definitive media where files will be
<br>
189 located, i.e; USB Stick, Hard Drive or SSD.
<br>
198 <tr><td id='footer' colspan=
2>
200 <span id='footer-msg'
></span>
201 <input type='button' value='Save' id='save-button' onclick='save()'
>
202 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'
>
206 <script type='text/javascript'
>verifyFields(null, 1);</script>