Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
server:web [2010/02/21 21:10] – digitalman | server:web [2020/11/18 06:19] – web_root_dir ecbbs | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Web Server ====== | ====== Web Server ====== | ||
+ | |||
+ | The Synchronet Web Server serves static (e.g. files) and dynamic content to HTTP clients (e.g. web browsers). | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 9: | Line 11: | ||
It also, through Server-Side JavaScript (SSJS), allows dynamic pages to be | It also, through Server-Side JavaScript (SSJS), allows dynamic pages to be | ||
created which can access BBS data directly. | created which can access BBS data directly. | ||
+ | |||
+ | For more information on the webv4 implementation, | ||
Line 15: | Line 19: | ||
==== Startup INI [Web] Section Keys ==== | ==== Startup INI [Web] Section Keys ==== | ||
- | The '' | + | The '' |
=== RootDirectory === | === RootDirectory === | ||
Line 24: | Line 28: | ||
'' | '' | ||
- | ::!:: Older versions of Synchronet had this value default to '' | + | **NOTE**: Older versions of Synchronet had this value default to '' |
=== ErrorDirectory === | === ErrorDirectory === | ||
Default value: '' | Default value: '' | ||
- | The directory relative to [# | + | The directory relative to [[# |
message files are located. | message files are located. | ||
numeric HTTP error code they will represent and may be either '' | numeric HTTP error code they will represent and may be either '' | ||
Line 47: | Line 51: | ||
=== Authorization === | === Authorization === | ||
- | Default value: '' | + | Default value: '' |
A comma-separated list of authentication mechanisms in order of preference. | A comma-separated list of authentication mechanisms in order of preference. | ||
Line 111: | Line 115: | ||
Default value: '' | Default value: '' | ||
- | The | separated list of options to enable. | + | The '' |
- | options, the web server also supports the following: | + | |
'' | '' | ||
+ | |||
Log all received data to the console log, as well as various | Log all received data to the console log, as well as various | ||
extra bits related to receiving data. | extra bits related to receiving data. | ||
'' | '' | ||
+ | |||
Log all transmitted data except the reply body itself, as well | Log all transmitted data except the reply body itself, as well | ||
as various extra bits of information related to transmitted | as various extra bits of information related to transmitted | ||
Line 124: | Line 129: | ||
'' | '' | ||
+ | |||
Supports name-based virtual hosts. | Supports name-based virtual hosts. | ||
host names, you can have each host name return unique content | host names, you can have each host name return unique content | ||
depending on which hostname is used. ie: if | depending on which hostname is used. ie: if | ||
- | freebsd.synchro.net and nix.synchro.net both resolved to your | + | '' |
system, you could have FreeBSD-specific pages on one, and | system, you could have FreeBSD-specific pages on one, and | ||
general *nix stuff on the other. | general *nix stuff on the other. | ||
A virtual host is added by simply putting the desired content | A virtual host is added by simply putting the desired content | ||
- | into a sub-directory of RootDirectory with the desired hostname | + | into a sub-directory of [[#RootDirectory]] with the desired hostname |
- | ie: web/ | + | ie: '' |
the request host name (very old browsers, or some automated | the request host name (very old browsers, or some automated | ||
tools) they will be served out of document root. | tools) they will be served out of document root. | ||
It is therefore a good idea to put links to your various | It is therefore a good idea to put links to your various | ||
- | virtual hosts in an index.html page in RootDirectory something | + | virtual hosts in an '' |
like this: | like this: | ||
- | | + | <code html> |
- | < | + | < |
- | < | + | |
- | </ | + | < |
- | < | + | </ |
- | Your browser is either too old to support | + | < |
- | name-based virtual hosts, or you have visited a | + | Your browser is either too old to support |
- | virtual hosts that is not yet configured. | + | name-based virtual hosts, or you have visited a |
- | following are hosted here:< | + | virtual hosts that is not yet configured. |
- | <a href=" | + | following are hosted here:< |
- | | + | <a href=" |
- | <a href=" | + | <a href=" |
- | </ | + | </ |
- | </ | + | </html> |
+ | </code> | ||
'' | '' | ||
+ | |||
Disable CGI script execution. | Disable CGI script execution. | ||
'' | '' | ||
+ | |||
Enable logging to a Common Logfile Format log as described in | Enable logging to a Common Logfile Format log as described in | ||
the HttpLogFile section. | the HttpLogFile section. | ||
Line 163: | Line 172: | ||
'' | '' | ||
+ | |||
Disable SSJS execution. | Disable SSJS execution. | ||
+ | '' | ||
+ | |||
+ | Enable TLS support. | ||
+ | |||
+ | '' | ||
+ | |||
+ | Indicates that all URLs availabe via http are also available via https and redirects clients who want a TLS session to the https location. | ||
==== Other configuration files ==== | ==== Other configuration files ==== | ||
- | In addition to the [Web] keys in the [[Startup INI]] file, the web server | + | In addition to the '' |
also uses some other configuration files: | also uses some other configuration files: | ||
Line 189: | Line 206: | ||
specified: | specified: | ||
- | == CGI == | + | == [CGI] == |
The [CGI] section is for natively-executed CGI handlers | The [CGI] section is for natively-executed CGI handlers | ||
- | (e.g. "pl = perl" indicates " | + | (e.g. "pl = perl" indicates " |
- | files). | + | |
- | == JavaScript == | + | == [JavaScript] == |
The [JavaScript] section is used for JS-executed content | The [JavaScript] section is used for JS-executed content | ||
Line 209: | Line 225: | ||
Each directory under the [[# | Each directory under the [[# | ||
the directory it's in and all child directories. | the directory it's in and all child directories. | ||
- | either globally, | + | either globally, in a per-filename group, or, in version 3.17 or greater, a per-directory-name group. |
- | the group name such as '' | + | Using the * and ? wildcards as the group name such as '' |
=== AccessRequirements === | === AccessRequirements === | ||
Specifices an ARS string which all users must match to be able to access | Specifices an ARS string which all users must match to be able to access | ||
files in this directory. | files in this directory. | ||
+ | |||
+ | For example, to require a login, but allow **any** user to access files in a | ||
+ | directory, but only a sysop to access '' | ||
+ | <file webctrl.ini> | ||
+ | AccessRequirements=level 0 | ||
+ | [*.log] | ||
+ | AccessRequirements=level 90 | ||
+ | [*.git] | ||
+ | AccessRequirements=level 90 | ||
+ | </ | ||
=== Realm === | === Realm === | ||
Line 242: | Line 268: | ||
current directory. | current directory. | ||
- | For example, to require | + | === FastCGISocket === |
- | directory, but only a sysop to access '' | + | Specifies the socket and port of a FastCGI listener |
- | AccessRequirements=level 0 | + | <file webctrl.ini> |
- | [*.log] | + | [*.php] |
- | AccessRequirements=level90 | + | FastCGISocket=127.0.0.1: |
+ | </ | ||
+ | |||
+ | Added on November 1st, 2015 to CVS (in 3.17a). | ||
+ | |||
+ | See [[howto: | ||
+ | |||
+ | === Rewrite* === | ||
+ | Specifies a Javascript snippet which can modify the http_request.request_string. | ||
+ | |||
+ | Added on November 3rd, 2015 to CVS (in 3.17a). | ||
+ | |||
+ | === JSPreExec === | ||
+ | A JavaScript snippet which is executed in the same context as Rewrite* lines, but before any Rewrites are executed. | ||
+ | Added on November 3rd, 2015 to CVS (in 3.17a). | ||
===== JavaScript Objects ===== | ===== JavaScript Objects ===== | ||
Line 347: | Line 387: | ||
==== Extra global methods ==== | ==== Extra global methods ==== | ||
- | The web server also adds new global JavaScript | + | The web server also adds a new global JavaScript |
set_cookie(string key, | set_cookie(string key, | ||
Line 355: | Line 395: | ||
[, string path | [, string path | ||
[, bool secure ]]]]) | [, bool secure ]]]]) | ||
- | | + | |
+ | |||
+ | ==== Extra global variables ==== | ||
+ | |||
+ | === web_root_dir === | ||
+ | The path to the web server' | ||
+ | |||
+ | See also: the RootDirectory key under [Web] in [[config: | ||
Line 362: | Line 409: | ||
support. | support. | ||
- | [Note: | + | [Note: |
- | nested.] | + | |
Line 381: | Line 427: | ||
=== Top Navigation === | === Top Navigation === | ||
- | ../ | + | ../ |
+ | | ||
- | The topnav.inc file contains the basic design of the " | + | The '' |
- | The links are dynamically generated by topnav_html.ssjs so both | + | The links are dynamically generated by '' |
files need to be addressed when modifying or creating themes. | files need to be addressed when modifying or creating themes. | ||
- | In the case of the default layout, topnav.inc has a left and right | + | In the case of the default layout, |
graphic and a middle section that the dynamic content goes. The | graphic and a middle section that the dynamic content goes. The | ||
background image is handled by CSS. You can change this to anything | background image is handled by CSS. You can change this to anything | ||
you like. | you like. | ||
- | The topnav_html.ssjs file may seem daunting at first, but it is | + | The '' |
pretty straight forward. | pretty straight forward. | ||
check the current page location and sets up the breadcrumbs based | check the current page location and sets up the breadcrumbs based | ||
Line 399: | Line 446: | ||
You want to add a Links page called links.html in the main | You want to add a Links page called links.html in the main | ||
directory. | directory. | ||
- | as: | + | as: |
- | if(http_request.virtual_path=="/ | + | |
- | template.topnav.push({html: | + | |
- | Some Links</ | + | |
+ | <code javascript> | ||
+ | if(http_request.virtual_path=="/ | ||
+ | template.topnav.push({html: | ||
+ | </ | ||
+ | | ||
=== Left Side Navigation === | === Left Side Navigation === | ||
- | ../ | + | |
+ | | ||
+ | | ||
This starts the main table layout in the default layout and also | This starts the main table layout in the default layout and also | ||
Line 434: | Line 485: | ||
==== SSJS Theme Support ==== | ==== SSJS Theme Support ==== | ||
- | |||
Theme Layouts can be added to Synchronet by creating them and placing the | Theme Layouts can be added to Synchronet by creating them and placing the | ||
Line 441: | Line 491: | ||
Themes are activated by editing the ../ | Themes are activated by editing the ../ | ||
This file contains: | This file contains: | ||
- | <FILE> | + | <code javascript> |
- | /* Set default theme name */ | + | /* Set default theme name */ |
- | var DefaultTheme=" | + | var DefaultTheme=" |
+ | |||
+ | /* Edit this bit to add/ | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | </ | ||
- | /* Edit this bit to add/ | ||
- | Themes[" | ||
- | Themes[" | ||
- | Themes[" | ||
- | Themes[" | ||
- | </ | ||
Themes are added by editing below the Default Theme such as: | Themes are added by editing below the Default Theme such as: | ||
- | <FILE> | + | <code javascript> |
- | Themes[" | + | Themes[" |
- | Themes[" | + | Themes[" |
- | Themes[" | + | Themes[" |
- | Themes[" | + | Themes[" |
- | </FILE> | + | </code> |
To change the Default Theme, change: | To change the Default Theme, change: | ||
- | | + | <code javascript> |
+ | var DefaultTheme=" | ||
+ | </ | ||
to: | to: | ||
- | + | <code javascript> | |
- | var DefaultTheme=" | + | var DefaultTheme=" |
+ | </ | ||
==== Special Codes Used in the SSJS Template System ==== | ==== Special Codes Used in the SSJS Template System ==== | ||
Line 477: | Line 529: | ||
For example the groups.inc: | For example the groups.inc: | ||
- | <CODE> | + | <code html> |
- | <!-- Main Content --> | + | <!-- Main Content --> |
| | ||
- | | + | <td class=" |
- | | + | <table class=" |
- | < | + | < |
- | <th class=" | + | <th class=" |
- | </ | + | </ |
- | << | + | << |
- | < | + | < |
- | <td class=" | + | <td class=" |
- | <a class=" | + | <a class=" |
- | %%groups: | + | %%groups: |
- | <td class=" | + | <td class=" |
- | @@JS: | + | @@JS: |
- | </ | + | </ |
- | <<END REPEAT groups>> | + | <<END REPEAT groups>> |
- | </ | + | </ |
- | <br /> | + | <br /> |
+ | |||
+ | <!-- end Main Content --> | ||
+ | </code> | ||
- | <!-- end Main Content --> | ||
- | </ | ||
While the table layout can be changed or even eliminated, the information | While the table layout can be changed or even eliminated, the information | ||
within the << | within the << | ||
To remove the table yet keep the correct infomation, the resulting groups.inc | To remove the table yet keep the correct infomation, the resulting groups.inc | ||
would be changed to (while maintaining the main table layout in this case) to: | would be changed to (while maintaining the main table layout in this case) to: | ||
- | <CODE> | + | <code html> |
- | <!-- Main Content --> | + | <!-- Main Content --> |
| | ||
<td class=" | <td class=" | ||
Line 518: | Line 571: | ||
<!-- end Main Content --> | <!-- end Main Content --> | ||
- | </CODE> | + | </code> |
- | This principle applies to all the .inc files in msgs respectively. | + | |
+ | This principle applies to all the .inc files in msgs respectively. | ||
==== The SSJS Template Library ==== | ==== The SSJS Template Library ==== | ||
Line 526: | Line 579: | ||
'' | '' | ||
- | i.e.; Spaces are replaced with: this& | + | i.e.; Spaces are replaced with: '' |
'' | '' | ||
- | i.e.; Spaces are replaced with: this%20is%20URI | + | i.e.; Spaces are replaced with: |
| | ||
- | '' | + | '' |
No changes or encoding is performed. | No changes or encoding is performed. | ||
- | '' | + | '' |
(^^ and %% are also supported) | (^^ and %% are also supported) | ||
- | '' | + | '' |
(^^ and %% are also supported) | (^^ and %% are also supported) | ||
- | | + | <code javascript> |
- | @@name: | + | << |
- | <<END REPEAT name>> | + | @@name: |
+ | <<END REPEAT name>> | ||
+ | </code> | ||
- | Iterates over the array/ | + | Iterates over the array/ |
- | the value of template.name.sname. | + | the value of '' |
(^^ and %% are also supported) | (^^ and %% are also supported) | ||
Line 555: | Line 610: | ||
Configuration settings for the SSJS Messaging system is located in the | Configuration settings for the SSJS Messaging system is located in the | ||
'' | '' | ||
- | <FILE> | + | <code javascript> |
max_messages=20; | max_messages=20; | ||
max_pages=30; | max_pages=30; | ||
Line 574: | Line 629: | ||
private_allowed_message='< | private_allowed_message='< | ||
private_reply_message='< | private_reply_message='< | ||
- | </FILE> | + | </code> |
Each of these are configurable. | Each of these are configurable. | ||
Line 592: | Line 647: | ||
For example, it can check if the user is Guest or an actual user with this line: | For example, it can check if the user is Guest or an actual user with this line: | ||
- | | + | <code javascript> |
+ | @@JS: | ||
+ | else '< | ||
+ | </ | ||
| | ||
What this does is display links specific for Registered Users only to them | What this does is display links specific for Registered Users only to them | ||
Line 611: | Line 669: | ||
For example: | For example: | ||
- | | + | <code javascript> |
+ | template.user_alias=user.alias; | ||
+ | </ | ||
Now '' | Now '' | ||
Line 641: | Line 701: | ||
either "<? | either "<? | ||
- | <CODE> | + | <code html> |
< | < | ||
< | < | ||
Line 648: | Line 708: | ||
</ | </ | ||
</ | </ | ||
- | </CODE> | + | </code> |
This would send the following web page to the remote system: | This would send the following web page to the remote system: | ||
- | <CODE> | + | <code html> |
< | < | ||
< | < | ||
Line 658: | Line 718: | ||
</ | </ | ||
</ | </ | ||
- | </CODE> | + | </code> |
Looping constructs are permitted, however, not using brackets can result in | Looping constructs are permitted, however, not using brackets can result in | ||
Line 665: | Line 725: | ||
The following example displays the numbers from one to 10. | The following example displays the numbers from one to 10. | ||
- | <CODE> | + | <code html> |
< | < | ||
< | < | ||
Line 676: | Line 736: | ||
</ | </ | ||
</ | </ | ||
- | </CODE> | + | </code> |
==== XJS-specific global methods and properties ==== | ==== XJS-specific global methods and properties ==== | ||
- | The following | + | The following |
=== xjs_load(filename) === | === xjs_load(filename) === | ||
Runs the specified xjs file at the current position. | Runs the specified xjs file at the current position. | ||
- | are NOT visible to xjs_load()ed pages. | + | are NOT visible to '' |
relative to the including file (or absolute.) | relative to the including file (or absolute.) | ||
=== cwd === | === cwd === | ||
Contains the path that the current xjs script was loaded from and which | Contains the path that the current xjs script was loaded from and which | ||
- | parameters to xjs_load() are assumed to be relative to. If you change | + | parameters to '' |
- | the value of cwd, it will change the location where xjs_load() will | + | the value of '' |
check for files. | check for files. | ||
+ | {{indexmenu_n> | ||