Ubuntu Server Useful Commands for Monitoring
htop df bmon
htop df bmon
String fileName="build.txt"; ClassLoader classLoader = getClass().getClassLoader(); InputStream in = classLoader.getResourceAsStream(fileName); BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(in)); String buildNumberStr= bufferedReader.readLine(); bufferedReader.close(); result=buildNumberStr;
References
https://www.mkyong.com/java/java-read-a-file-from-resources-folder/
References
https://robots.thoughtbot.com/how-to-make-a-chrome-extension
https://developer.chrome.com/extensions/getstarted
http://stackoverflow.com/questions/11553600/how-to-inject-css-using-content-script-file-in-chrome-extension
http://stackoverflow.com/questions/9721344/my-css-is-not-getting-injected-through-my-content-script
sudo add-apt-repository ppa:diodon-team/stable
Installed systemd unit for VNC Server in Service Mode daemon
Start or stop the service with:
systemctl (start|stop) vncserver-x11-serviced.service
Mark or unmark the service to be started at boot time with:
systemctl (enable|disable) vncserver-x11-serviced.service
Installed systemd unit for VNC Server in Virtual Mode daemon
Start or stop the service with:
systemctl (start|stop) vncserver-virtuald.service
Mark or unmark the service to be started at boot time with:
systemctl (enable|disable) vncserver-virtuald.service
Apache
a2enmod proxy a2enmod ssl a2enmod proxy_http a2enmod proxy_ajp a2enmod rewrite a2enmod deflate a2enmod headers a2enmod proxy_balancer a2enmod proxy_connect a2enmod proxy_html sudo a2enmod remoteip sudo service apache2 restart
<VirtualHost *:80> ServerName iterator.ir ProxyRequests Off ProxyPreserveHost On RemoteIPHeader X-Forwarded-For <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:13602/ ProxyPassReverse / http://localhost:13602/ </VirtualHost>
<VirtualHost *:443> SSLEngine on RewriteEngine on SSLCertificateKeyFile /etc/letsencrypt/live/lastlab.pupli.net/privkey.pem SSLCertificateFile /etc/letsencrypt/live/lastlab.pupli.net/cert.pem SSLCertificateChainFile /etc/letsencrypt/live/lastlab.pupli.net/chain.pem ServerName lastlab.pupli.net ProxyRequests Off ProxyPreserveHost On RemoteIPHeader X-Forwarded-For <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:14001/ ProxyPassReverse / http://localhost:14001/ </VirtualHost>
Spring Boot
set server.use-forward-headers to server.use-forward-headers in Spring Boot application.properties
Java
String ipAddress = request.getHeader("X-FORWARDED-FOR"); if (ipAddress == null) { ipAddress = request.getRemoteAddr(); }
References
https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-servlet-containers.html#howto-use-tomcat-behind-a-proxy-server
https://www.mkyong.com/java/how-to-get-client-ip-address-in-java/
http://serverfault.com/questions/130925/passing-ip-address-with-mod-proxy
https://www.leaseweb.com/labs/2014/12/tutorial-apache-2-4-transparent-reverse-proxy/
http://www.thegeekstuff.com/2011/07/Apache-Virtual-Host/
https://devops.profitbricks.com/tutorials/configure-apache-as-a-reverse-proxy-using-mod_proxy-on-ubuntu/
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
apply plugin: 'org.springframework.boot' springBoot { executable = true }
Installation as a systemd service
/etc/systemd/system
[Unit] Description=erpserver [Service] User=root ExecStart=/var/erpserver/erpserver-1.0.0.jar SuccessExitStatus=143 [Install] WantedBy=multi-user.target
service erpserver start
Keywords
deploy , jar
References
http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
first configure DNS :
a2enmod proxy_http
nano /etc/apache2/apache2.conf
<VirtualHost *:80> ServerName public.server.name ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>
Keywords
apache , virtual host , VirtualHost , reverse , proxy
References
http://stackoverflow.com/questions/956361/apache-tomcat-using-mod-proxy-instead-of-ajp
https://httpd.apache.org/docs/2.4/vhosts/examples.html
http://askubuntu.com/questions/58179/install-mod-proxy-to-get-proxypass-to-work
http://www.thegeekstuff.com/2011/07/Apache-Virtual-Host/
Go to /etc/apt. Create the file apt.conf if you don’t have it there. Write the following lines there.
Acquire::http::proxy "http://username:password@proxyserver:port/"; Acquire::https::proxy "https://username:password@proxyserver:port/"; Acquire::socks::proxy "socks://username:password@proxyserver:port/"; Acquire::ftp::proxy "ftp://username:password@proxyserver:port/";
Save it. You are done.
Keywords
apt , ubuntu , proxy