Configure the TCAdmin website to run with Nginx
- 1 Install Nginx
- 2 Configure TCAdmin to Execute the Fastcgi Server
- 3 Configure Nginx
- 4 Configure the website to allow secure connections
- 5 Change the default ports
- 6 Enable logging
- 7 Common Errors
Follow these instructions to install the latest version of Nginx: http://nginx.org/en/linux_packages.html Note: The Nginx version included in your distro might be outdated. It is recommended to install the latest version from the Nginx website.
Configure TCAdmin to Execute the Fastcgi Server
If you are running Debian or Ubunto with Mono 4 install the mono-fastcgi-server4 package:
apt-get install mono-fastcgi-server4
If you are running CentOS with Mono 4 make sure you have the xsp package:
yum install xsp
Edit the file /home/tcadmin/Monitor/tcadmin-config. Change this line:
If the line doesn't exist add it at the end.
Then restart the monitor service:
Edit the file /etc/nginx/nginx.conf and change:
Then execute these commands:
chown --recursive tcadmin:tcadmin /var/lib/nginx service nginx restart
Configure the control panel website
Create the file /etc/nginx/conf.d/default.conf with the following content. If it already exists rename the existing file to default.conf.old. If you plan on using a certificate from Let's Encrypt you must update the value of server_name. TCAdmin version 2.0.128 and greater is now using MVC templates by default. You must use the default.conf from this page: MVC_Templates#Linux_Nginx_configuration_.28optional.29
After creating the file restart the nginx server:
service nginx restart
Configure the website to allow secure connections
Create a self signed certificate
The default certificate and private key used by TCAdmin are not compatible with nginx. You must create new ones. Execute the following commands. When it asks for a passphrase enter a word that you can remember. If you already have a certificate place the files in the Monitor folder, make tcadmin the owner and update the paths in the ssl_certificate and ssl_certificate_key parameters.
cd /home/tcadmin/Monitor openssl genrsa -des3 -out nginx.key 2048
Execute this command. Enter the passphrase that you used in the first step. You can leave all other values blank.
openssl req -new -key nginx.key -out nginx.csr
Execute this command. Enter the passphrase that you used in the first step.
mv nginx.key nginx.key.org openssl rsa -in nginx.key.org -out nginx.key
Execute this command to create the certificate file.
openssl x509 -req -days 7300 -in nginx.csr -signkey nginx.key -out nginx.crt
Add the following lines to /etc/nginx/conf.d/default.conf under listen 8880;.
listen 8881 ssl; ssl_certificate /home/tcadmin/Monitor/nginx.crt; ssl_certificate_key /home/tcadmin/Monitor/nginx.key;
After updating the file restart the nginx server:
service nginx restart
Change the default ports
If you change the default ports in /etc/nginx/conf.d/default.conf make sure you update the values of WEB_PORT and SECURE_WEB_PORT in /home/tcadmin/Monitor/tcadmin-config and restart the monitor service:
Logging is commented out in the above configuration. You can enable it by changing #access_log to access_log and reloading the nginx service. That will create a single log file that can get huge after a few days. You can configure log rotation with these instructions: http://www.nginxtips.com/how-to-rotate-nginx-logs/
Object reference error when logging in
This should only happen the first time you log in after changing the web server.
Port already in use
If Nginx says the port is already in use make sure you configured TCAdmin to start the fastcgi server instead of the built in web server and restarted the monitor. Also check if there is a process using port 8880 and kill it:
netstat -tlnp|grep 8880
Website doesn't load
Try starting nginx:
service nginx start