X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=monitor-server.init;h=28a7df82dad003df1886583baa377728e5ed37c7;hb=786822939c1d244e30172b997f91dd4aafb2ff24;hp=c477c89a743ca458faa70b69028d5f871e6121e0;hpb=f4c8ac6cb9e1418ced303fd9f715e76b275af00d;p=monitor.git diff --git a/monitor-server.init b/monitor-server.init index c477c89..28a7df8 100644 --- a/monitor-server.init +++ b/monitor-server.init @@ -242,47 +242,33 @@ function create_httpd_conf () WROTE_HTTP_CONFIG="true" fi - # TODO: make http port configurable. + # TODO: support HTTPS as well as port 80. currently not specifying port + # 80 breaks https for other content on the myplc. # TODO: make proxy port configurable. cat < ${MONITOR_HTTP_CONF} -NameVirtualHost ${PLC_MONITOR_IP}:80 - - ServerName ${PLC_MONITOR_HOST} - ServerAdmin ${PLC_MONITOR_EMAIL} - UseCanonicalName Off - ServerSignature Off +# NOTE: I've tried other means of redirection, including mod_rewrite, but did +# not have any success. The means below is not idea, b/c it does not keep +# non-ssl session as non-ssl. But it works. - DocumentRoot ${MONITORPATH}/web/MonitorWeb/monitorweb - - - Options Indexes FollowSymLinks - AllowOverride None - Order allow,deny - Allow from all - +# NOTE: redirect path without trailing '/' to path with. Favor SSL. +Redirect /monitor https://${MONITOR_HOSTNAME}:${PLC_WWW_SSL_PORT}/monitor/ +# NOTE: this directive strips '/monitor/' from the requested path and pastes +# the remaining part to the end of the ProxyPass url below. All TG urls +# should be relative to their current position, or the absolute path +# that includes /monitor/ at the beginning. +# TODO: make location configurable. + #LogLevel debug - Errorlog /var/log/httpd/monitorwebapp-error_log - Customlog /var/log/httpd/monitorwebapp-access_log common - - AddDefaultCharset utf-8 - - #NOTE: This doesn't work as expected. - # Load everything out of the DocumentRoot that is static - # ProxyPass /monitor/static ! - - ProxyPass /tg_js http://127.0.0.1:8080/tg_js - ProxyPassReverse /tg_js http://127.0.0.1:8080/tg_js + #Errorlog /var/log/httpd/monitorwebapp-error_log + #Customlog /var/log/httpd/monitorwebapp-access_log common - ProxyPass /monitor http://127.0.0.1:8080 - ProxyPassReverse /monitor http://127.0.0.1:8080 + ProxyPass http://127.0.0.1:8080/ + ProxyPassReverse http://127.0.0.1:8080/ + - ProxyPreserveHost On - ProxyRequests Off - - EOF } @@ -293,6 +279,14 @@ function start_tg_server () popd } +function stop_tg_server () +{ + pid=$( cat /var/run/monitorweb.pid ) + if [ -n "$pid" ] ; then + kill $pid + fi +} + function check_zab_server () { ZABBIXCFG=/etc/zabbix @@ -303,7 +297,7 @@ function check_zab_server () -e "s#DBName=.*#DBName=$ZABBIX_DB_NAME#g" \ -e "s#DBUser=.*#DBUser=$ZABBIX_DB_USER#g" \ -e "s#DBPassword=.*#DBPassword=$PLC_MONITOR_DBPASSWORD#g" \ - -e "s/.*ExternalScripts=.*/ExternalScripts=${MONITORPATH}\/zabbix/g" \ + -e "s#.*ExternalScripts=.*#ExternalScripts=${MONITORPATH}/zabbix#g" \ ${ZABBIXCFG}/zabbix_server.conf > $TMP_FILE cat $TMP_FILE > ${ZABBIXCFG}/zabbix_server.conf fi @@ -415,6 +409,7 @@ case "$1" in MESSAGE=$"Stopping Monitor" dialog "$MESSAGE" + stop_tg_server service zabbix_server stop service zabbix_agentd stop # TODO: is there anything to stop?