Difference between revisions of "MVC Templates"
From TCAdmin 2.0 Documentation
Line 31: | Line 31: | ||
== Nginx configuration (optional) == | == Nginx configuration (optional) == | ||
+ | Configure Nginx with these instructions but use this default.conf instead of one provided in that tutorial: [[Configure_the_TCAdmin_website_to_run_with_Nginx]] | ||
+ | upstream tcadmin-fcgi { | ||
+ | ip_hash; | ||
+ | server unix:/home/tcadmin/Temp/fastcgi-socket-1; | ||
+ | } | ||
+ | |||
+ | upstream tcadmin-fcgi-mvc { | ||
+ | ip_hash; | ||
+ | server unix:/home/tcadmin/Temp/fastcgi-socket-mvc-1; | ||
+ | } | ||
+ | |||
+ | server { | ||
+ | #the following line is required if you want to configure with Let's Encrypt | ||
+ | #server_name tcadmin.yourdomain.com; | ||
+ | fastcgi_temp_path /home/tcadmin/Temp 1 2; | ||
+ | client_body_temp_path /home/tcadmin/Temp 1 2; | ||
+ | listen 8880; | ||
+ | #access_log /home/tcadmin/Logs/nginx.log; | ||
+ | index index.html index.htm default.aspx Default.aspx; | ||
+ | |||
+ | #Support for Let's encrypt tools | ||
+ | location /.well-known { | ||
+ | try_files $uri $uri/ =404; | ||
+ | } | ||
+ | |||
+ | #Everything else served by fastcgi server | ||
+ | location / { | ||
+ | fastcgi_ignore_client_abort on; | ||
+ | fastcgi_pass tcadmin-fcgi-mvc; | ||
+ | include fastcgi_params; | ||
+ | fastcgi_split_path_info ^(.+\.as[pmh]x)(.*)$; | ||
+ | fastcgi_param PATH_INFO $fastcgi_path_info; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | fastcgi_keep_conn off; | ||
+ | fastcgi_buffering off; | ||
+ | gzip off; | ||
+ | client_max_body_size 100m; | ||
+ | } | ||
+ | |||
+ | #Everything else served by fastcgi server | ||
+ | location /Aspx { | ||
+ | fastcgi_ignore_client_abort on; | ||
+ | fastcgi_index Default.aspx; | ||
+ | fastcgi_pass tcadmin-fcgi; | ||
+ | include fastcgi_params; | ||
+ | fastcgi_split_path_info ^(.+\.as[pmh]x)(.*)$; | ||
+ | fastcgi_param PATH_INFO $fastcgi_path_info; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | fastcgi_keep_conn off; | ||
+ | fastcgi_buffering off; | ||
+ | gzip off; | ||
+ | client_max_body_size 100m; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | After creating the file restart the nginx server: | ||
+ | <source lang="bash"> | ||
+ | service nginx restart</source> | ||
== IIS configuration (optional) == | == IIS configuration (optional) == |
Revision as of 13:35, 24 March 2019
Currently MVC templates are only supported on Windows. The MVC templates are currently in beta testing.
Contents
Features
- The following features are configurable in the game settings:
- Custom background images per game. Place the images in TCAdmin2\ControlPanel.MVC\Views\Default so they are used in all your custom themes.
- Custom service home page template per game. (change whole layout of the service home page)
- Custom status template per game. (change which information and ports are displayed)
- Join URL
- Responsive design.
- Editable HTML templates.
- Create a new theme in Settings > Themes. Set the type to MVC. A folder will be created in TCAdmin2\ControlPanel.MVC\Views where you can place your custom .cshtml and images.
- Your custom template folder only needs to have the files that have been modified.
- If a file doesn't exist in your custom template it will use the file from the default template. Use the same directory structure as the Default template.
- You can safely add files to the default template folder but all the original files will be overwritten when you update TCAdmin.
- To translate MVC templates go to Settings > Languages > select the language > Other Components > Resources.*.
Requirements
- .NET 4.5 must be installed on your server. MVC templates will not work if you only have .NET 4.0 installed.
- Install TCAdmin version 2.0.126.0 or greater.
Configure TCAdmin
- Edit TCAdmin2\Monitor\TCAdminMonitor.exe.config. Add these lines under <appSettings> (update them if they already exist).
<add key="TCAdmin.Public.MVC" value="True" /> <add key="TCAdmin.Public.MVC.WebServicesPath" value="../ControlPanel.MVC" />
- Restart the monitor service.
Update the WHMCS module (optional)
Make a backup of your /whmcs/modules/servers/tcadmin2_advanced/tcadmin2_advanced.php and replace it with this file. This module has the links updated to work with the MVC template format.
File:Tcadmin2 advanced mvc.zip
Nginx configuration (optional)
Configure Nginx with these instructions but use this default.conf instead of one provided in that tutorial: Configure_the_TCAdmin_website_to_run_with_Nginx
upstream tcadmin-fcgi { ip_hash; server unix:/home/tcadmin/Temp/fastcgi-socket-1; } upstream tcadmin-fcgi-mvc { ip_hash; server unix:/home/tcadmin/Temp/fastcgi-socket-mvc-1; } server { #the following line is required if you want to configure with Let's Encrypt #server_name tcadmin.yourdomain.com; fastcgi_temp_path /home/tcadmin/Temp 1 2; client_body_temp_path /home/tcadmin/Temp 1 2; listen 8880; #access_log /home/tcadmin/Logs/nginx.log; index index.html index.htm default.aspx Default.aspx; #Support for Let's encrypt tools location /.well-known { try_files $uri $uri/ =404; } #Everything else served by fastcgi server location / { fastcgi_ignore_client_abort on; fastcgi_pass tcadmin-fcgi-mvc; include fastcgi_params; fastcgi_split_path_info ^(.+\.as[pmh]x)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_keep_conn off; fastcgi_buffering off; gzip off; client_max_body_size 100m; } #Everything else served by fastcgi server location /Aspx { fastcgi_ignore_client_abort on; fastcgi_index Default.aspx; fastcgi_pass tcadmin-fcgi; include fastcgi_params; fastcgi_split_path_info ^(.+\.as[pmh]x)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_keep_conn off; fastcgi_buffering off; gzip off; client_max_body_size 100m; } }
After creating the file restart the nginx server:
service nginx restart
IIS configuration (optional)
- Configure the website in IIS with these instructions: Configure_the_TCAdmin_website_to_run_with_IIS The only difference is that your main website will point to TCAdmin2\ControlPanel.MVC. If you already have your website configured in IIS just change the website path to TCAdmin2\ControlPanel.MVC.
- In IIS Manager right click on the control panel website and select add application. Set the alias to Aspx and point it to TCAdmin2\ControlPanel. Both must run with the classic .NET application pool.
- Follow steps 1 to 6 for both TCAdmin2\ControlPanel\Web.config and TCAdmin2\ControlPanel.MVC\Web.config Frequently_Asked_Questions#Configuring_your_IIS_website_with_more_than_1_worker_process_.28optional.29
Going back to the classic ASP.NET themes
If you want to go back to the classic ASP.NET themes:
- Edit TCAdmin2\Monitor\TCAdminMonitor.exe.config and set the value of TCAdmin.Public.MVC to False
- Restart the monitor.