Forum Replies Created
-
AuthorPosts
-
kumajaya
ParticipantMy English not good enough to explain but I can upload RS project from Windows to Linux over internet easily.
kumajaya
Participant@Mikhail Today I realized how simple NPort in TCP mode. Thank you.
Not actually NPort device I use here but a GSM modem from Moxa with a serial port. With a private IP from GSM operator, the only option to access it is via OnCell Central Manager. OCM map the serial port to a local TCP port.
kumajaya
ParticipantAt least we have 2 options to run RS with SSL even with a negative impact if exists. Nginx + Mono FastCGI will be perfect for RS but I have multiple application run under Apache for now.
kumajaya
ParticipantRun Mono FastCGI via Nginx behind Apache (even Apache behind Nginx must be better):
1. Install Nginx:
sudo apt-get install nginx
2. Change Nginx default port from 80 to 8008 and add /scada-fastcgi virtual path:
sudo nano /etc/nginx/sites-available/default
listen 8008 default_server; listen [::]:8008 default_server;
location /scada-fastcgi { index index.html index.htm default.aspx Default.aspx; fastcgi_index index.htm; fastcgi_pass 127.0.0.1:9000; include /etc/nginx/fastcgi_params; }
3. Edit Nginx FastCGI parameter:
sudo nano /etc/nginx/fastcgi_params
fastcgi_param PATH_INFO ""; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
4. Edit Apache config and reload it:
sudo nano /etc/apache2/sites-enabled/default-ssl.conf
ProxyPass /scada-fastcgi http://127.0.0.1:8008/scada-fastcgi ProxyPassReverse /scada-fastcgi http://127.0.0.1:8008/scada-fastcgi
sudo systemctl reload apache2
5. Install Mono FastCGI if needed, run it:
sudo apt-get install mono-fastcgi-server
fastcgi-mono-server4 /applications=/scada-fastcgi:/var/www/html/scada/ /socket=tcp:127.0.0.1:90006. Start Nginx:
sudo systemctl reload nginx
You can access SCADA web at https://yourserver/scada-fastcgi
kumajaya
ParticipantNo problem here, I can access for example http://scada.myserver.com/ without a redirect. But to be honest, I’m not expert in Apache configuration.
kumajaya
ParticipantI think run scada web as web root for my server is not a good idea since I also use it for different service.
1. Edit scada-xsp4 config:
sudo nano /etc/xsp4/scada.webapp
<apps> <web-application> <name>scada</name> <vpath>/scada</vpath> <path>/opt/scada/ScadaWeb</path> </web-application> </apps>
2. Edit Apache config:
sudo nano /etc/apache2/sites-enabled/default-ssl.conf
SSLProxyEngine on SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerName off SSLProxyCheckPeerExpire off ProxyPreserveHost off ProxyRequests off ProxyVia off ProxyPass /scada http://127.0.0.1:8000/scada ProxyPassReverse /scada http://127.0.0.1:8000/scada
3. Disable scada web in Apache:
sudo a2dissite scada.conf
4. Restart scada-xsp4 service:
sudo service scada-xsp4 stop
ps ax –> to check mono pid that load xsp4.exe
sudo kill -9 pid_from_previous_step
sudo service scada-xsp4 start5. Restart Apache:
sudo service apache2 restart
kumajaya
ParticipantYou’re welcome! Just a litle bit contribution from me.
kumajaya
ParticipantI can’t edit my previous post, you can test previous configuration by accessing for example https://scada.rapidscada.org/ after restarting Apache web server:
sudo service apache2 restart
For my future references:
1. Run Apache and Nginx together: http://kbeezie.com/apache-with-nginx/
2. Mono and Nginx: https://www.mono-project.com/docs/web/fastcgi/nginx/kumajaya
ParticipantPART 2: Apache configuration
Depend on your server configuration, my working /etc/apache2/sites-enabled/default-ssl.conf configuration:
SSLProxyEngine on SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerName off SSLProxyCheckPeerExpire off ProxyPreserveHost off ProxyRequests off ProxyVia off ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000/
kumajaya
ParticipantI believe Nginx must be better but since somehow mono-xsp4 available on my Ubuntu system:
PART 1: mono-xsp configuration
1. Copy /etc/init.d/mono-xsp4 as /etc/init.d/scada-xsp4 and modify it:
sudo cp /etc/init.d/mono-xsp4 /etc/init.d/scada-xsp4
sudo nano /etc/init.d/scada-xsp4#! /bin/sh ### BEGIN INIT INFO # Provides: mono-xsp4 # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Mono XSP4 # Description: Debian init script for Mono XSP4. ### END INIT INFO # # Written by Pablo Fischer <pablo@pablo.com.mx> # Dylan R. E. Moonfire <debian@mfgames.com> # Modified for Debian GNU/Linux # # Version: @(#)mono-xsp4 pablo@pablo.com.mx # # Variables PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/xsp4 NAME=scada-xsp4 DESC="XSP 4.0 WebServer" DEFAULT=/etc/default/$NAME CFGDIR=/etc/xsp4 VIRTUALFILE=$CFGDIR/scada.webapp MONO_SHARED_DIR=/var/run/$NAME start_boot=false # Use LSB . /lib/lsb/init-functions # If we don't have the basics, don't bother test -x $DAEMON || exit 0 test -f $DEFAULT && . $DEFAULT if [ "x$start_boot" != "xtrue" ] ; then exit 0 fi if [ ! -e $MONO_SHARED_DIR ]; then mkdir $MONO_SHARED_DIR chown $user:$group $MONO_SHARED_DIR fi should_start() { if [ ! -e $VIRTUALFILE -o <code>cat $VIRTUALFILE | wc -l</code> = "2" ]; then log_action_msg "You have an incomplete $VIRTUALFILE" log_action_msg "To fix it, you need to install at least one package for xsp4 (like asp.net-examples)" return 1 fi if [ -f /var/run/$NAME.pid ]; then # Are we really running xsp4? xsp4_pid=<code>cat /var/run/$NAME.pid</code> xsp4_ps=<code>ps -p $xsp4_pid | wc -l</code> if [ "$xsp4_ps" != "1" ]; then log_action_msg "Sorry, there is already a xsp4 running, stop it first" return 1 fi fi return 0 } case "$1" in start) if should_start ; then log_daemon_msg "Starting $DESC" "$NAME" export MONO_SHARED_DIR start-stop-daemon --start --background --make-pidfile \ --quiet --pidfile /var/run/$NAME.pid \ --user $user --group $group --chuid $user \ --exec $DAEMON -- \ --port $port --address $address --appconfigdir \ $CFGDIR --nonstop log_end_msg $? fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" for i in $(ps aux | grep -v grep | grep 'xsp4.exe' | cut -c 10-15) do kill $i > /dev/null 2>&1 done log_end_msg $? ;; restart|force-reload) $0 stop $0 start ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0
2. Copy /etc/default/mono-xsp4 as /etc/default/scada-xsp4 and modify it:
sudo cp /etc/default/mono-xsp4 /etc/default/scada-xsp4
sudo nano /etc/default/scada-xsp4# Defaults for mono-xsp4, official version # sourced by /etc/init.d/scada-xsp4 # Should we start it? start_boot=true # User and group by default user=www-data group=www-data # Default port port=8000 address=0.0.0.0 # Directory for config files config_files=/etc/scada-xsp4
3. Copy /etc/xsp4/debian.webapp as /etc/xsp/scada.webapp and modify it:
sudo cp /etc/xsp4/debian.webapp /etc/xsp4/scada.webapp
sudo nano /etc/xsp4/scada.webapp<apps> <web-application> <name>scada</name> <vpath>/</vpath> <path>/opt/scada/ScadaWeb</path> </web-application> </apps>
4. Activate scada-xsp4 service and start it:
cd /etc/init.d/
sudo chmod +x scada-xsp4
sudo update-rc.d scada-xsp4 defaults
sudo service scada-xsp4 start5. Open http://localhost:8000 on your browser for testing
kumajaya
Participanthttps://store.chipkin.com/products/tools/cas-modbus-scanner has a feature to scan available device address.
kumajaya
ParticipantWhy not just set it as a virtual com port using https://www.waveshare.com/wiki/File:USR-VCOM_V3.7.1.520.7z and test the communication using a Modbus tester application first.
kumajaya
ParticipantI just want to confirm GrafanaDataProvider works good so far. Please remember to release official build.
kumajaya
ParticipantUsually I use a Modbus tester application to confirm Modbus RTU/TCP communication. You can try https://store.chipkin.com/products/tools/cas-modbus-scanner or https://github.com/ed-chemnitz/qmodbus
kumajaya
ParticipantLet me try it, I’ll report back later. Big thanks.
-
AuthorPosts