Difference between revisions of "Configure the TCAdmin website to run with Nginx"
Line 28: | Line 28: | ||
== Configure Nginx to work with Mono's fastcgi server == | == Configure Nginx to work with Mono's fastcgi server == | ||
− | Add the following lines to '''/etc/nginx/fastcgi_params''' | + | Add the following lines to '''/etc/nginx/fastcgi_params''' |
<source lang="bash"> | <source lang="bash"> | ||
fastcgi_param PATH_INFO ""; | fastcgi_param PATH_INFO ""; |
Revision as of 15:33, 13 February 2015
Contents
Install Nginx
The following instructions are provided for your convenience. We do not provide support for installing Nginx on your server. For detailed instructions read the Nginx manual or your distro's manual.
CentOS
yum install epel-release yum install nginx
Debian/Ubuntu
apt-get install nginx
Configure TCAdmin to execute the fastcgi server instead of the default web server
Edit the file /home/tcadmin/Monitor/tcadmin-config. Change this line:
ENABLE_FASTCGI_SERVER="False"
to:
ENABLE_FASTCGI_SERVER="True"
If the line doesn't exist add it at the end.
Then restart the monitor service:
/home/tcadmin/Monitor/monitor-service restart
Configure Nginx to work with Mono's fastcgi server
Add the following lines to /etc/nginx/fastcgi_params
fastcgi_param PATH_INFO ""; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
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.
server { listen 8880; #access_log /home/tcadmin/Logs/nginx.log; location / { index index.html index.htm default.aspx Default.aspx; fastcgi_index Default.aspx; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_split_path_info ^(.+.as[pmh]x)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; } }
After creating the file reload the nginx settings:
service nginx reload
Configure the website to allow secure connections
Create a self signed certificate
Execute the following commands. When it asks for a passphrase enter a word that you can remember.
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 this to /etc/nginx/conf.d/default.conf.
server { listen 8881; #access_log /home/tcadmin/Logs/nginx.log; ssl on; ssl_certificate /home/tcadmin/Monitor/nginx.crt; ssl_certificate_key /home/tcadmin/Monitor/nginx.key; location / { index index.html index.htm default.aspx Default.aspx; fastcgi_index Default.aspx; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_split_path_info ^(.+.as[pmh]x)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; } }
After updating the file reload the nginx settings:
service nginx reload
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:
/home/tcadmin/Monitor/monitor-service restart
Common errors
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