Create a batch file to check the status of a Windows Service(s) and start it if its not started. The batch file can also be run inside "Task Scheduler" at an interval basis.
1. First, you need to find out the Service Name that you want to monitor, in this example let's say the service you need to monitor is an Exchange Server IMAP4 service.
2. Open --> Services and browse through the list until you found the IMAP4 service.
3. Right-click the Service Name --> Properties.
4. Take note of the "Service name:", copy the name to Notepad. As per below screenshot, the service name is "MSExchangeImap4".
5. Create a batch file as below :-
@ECHO OFF
CLS
SETLOCAL ENABLEDELAYEDEXPANSION
SET /A RETRY_IMAP=0
SET /A MAX_RETRIES=3
SET EXCH_IMAP= MSExchangeImap4
REM To check current status of the service.
:check_imap
SC QUERY %EXCH_IMAP% | FIND "RUNNING" >NUL
IF %ERRORLEVEL%==0 (
ECHO Exchange IMAP4 Service is Running.
GOTO end
)
REM To start the service if the status is stopped.
ECHO Exchange IMAP4 Service is Stopped.
SC START %EXCH_IMAP%
TIMEOUT /T 10 >NUL
REM To re-check the service status again for confirmation.
SC QUERY %EXCH_IMAP% | FIND "RUNNING" >NUL
IF %ERRORLEVEL%==0 (
ECHO Exchange IMAP4 Service is Running.
GOTO end
)
REM Retrying to start the service with a maximum of 3 retries only.
ECHO Max Retries Reached for %EXCH_IMAP%, will stop retrying.
GOTO end
)
:end
EXIT
6. You can now test run the batch file and create a "Task Scheduler" to run the check at an interval basis (eg. every 2 hours or at Startup of the server).
Nginx Proxy Manager (NPM) is a user friendly, open source tool that simplifies the management of Nginx Reverse Proxy configurations. It have a Web UI for creating and managing Proxy Hosts, SSL Certificates and User Management and Permissions.
NPM makes managing services exposed to the Internet easily and securely. For easy installation and consistent environment, NPM runs on Docker.
services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: # These ports are in format <host-port>:<container-port> - '80:80' # Public HTTP Port - '443:443' # Public HTTPS Port - '81:81' # Admin Web Port # Add any other Stream port you want to expose # - '21:21' # FTP environment: # Mysql/Maria connection parameters: DB_MYSQL_HOST: "db" DB_MYSQL_PORT: 3306 DB_MYSQL_USER: "npm" DB_MYSQL_PASSWORD: "npm" DB_MYSQL_NAME: "npm" # Uncomment this if IPv6 is not enabled on your host # DISABLE_IPV6: 'true' volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt depends_on: - db
19. Create Docker Network for Nginx Proxy Manager.
sudo docker network create npm-nw
20. Start Nginx Proxy Manager.
sudo docker-compose up -d
21. Check the Docker Status.
sudo docker ps
22. Open favorite browser (eg. Google Chrome) and browse the following address. You should be able to see a Nginx Proxy Manager Welcome Page.
http://[IP Address]
23. Now login to Nginx Proxy Manager Admin Web UI, please note the port number is 81.
http://[IP Address]:81
24. Login with the default Username and Password as below.
Default Username : admin@example.com
Default Password : changeme
25. After successfully login, you will be prompted to change the Username and Password, please proceed to change it accordingly and remember the new Username and Password.
AntMedia Server (AMS) is an Open-Source, Self-Hosted Video Streaming Platform. It supports steaming of pre-recorded videos to supported website such as Youtube, Twitch, HTML etc.
1. Ensure that you already have Ubuntu installed and updated with the latest packages. Also you need to have Apache2 web server pre-installed, up and running.
2. First, download the latest version of AntMedia Server Community Edition.
ProxyRequest off ProxyPass / http://127.0.0.1:5080/ ProxyPassReverse / http://127.0.0.1:5080/
</VirtualHost>
7. Enable Apache modules accordingly.
sudo a2enmod proxy proxy_http
8. Enable the new virtual site.
sudo a2ensite [domain.com].conf
9. Enable SSL for AntMedia Server.
cd /usr/local/antmedia
sudo ./enable_ssl.sh -d [domain.com]
10. Ensure the following ports is accessible to the server.
Port Number
Protocol
Descriptions
80
TCP
SSL
5080
TCP
HTTP
5443
TCP
HTTPS
4200
UDP
SRT
1935
TCP
RTMP
50000 - 60000
UDP
WebRTC
5000
TCP
Multi-Nodes Cluster (optional)
11. Restart Apache Server.
sudo systemctl restart apache2
12. Open your favorite browser (eg. Google Chrome), browse the following URL.
http://[domain.com]:5080
13. Once the page have been loaded, you will be prompted to create the first administrator account. Procced to create the admin account and login afterward.
NextCloud is an Open Source, Self-Hosted or Cloud Hosted, File Sync and Sharing Platform. It's Secure, Private and Easy to use. Compatible with Windows, Linux, Android and Apple iOS devices.
This is assuming that you already have Ubuntu Server installed, patched and updated.
<IfModule mod_headers.c> Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains" </IfModule>
</VirtualHost>
13. Configure and modify PHP file. Modify the value according to your requirements.
memory_limit = 512M
upload_max_filesize = 512M
max_execution_time = 360
post_max_size = 512M
date.timezone = Asia/Kuala_Lumpur
opcache.enable = 1
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 128
opcache.save_comments = 1
opcache.revalidate_freq = 1
14. Enabled Apache modules for NextCloud use.
sudo a2enmod dir env headers mime rewrite ssl
15. Enable APCU module in PHP.
sudo nano /etc/php/8.3/mods-available/apcu.ini
add the following line :-
apc.enable_cli = 1
16. Open your favorite browser, such as Google Chrome browser. And type the URL of NextCloud server (eg. http://demo.com). At the main screen, you need to configure the NextCloud Database (eg. nextcloud) created earlier including its username (eg. ncuser) & password (eg. ncpass). You also need to create the First Administrator account with a valid email address too.
17. NextCloud screen will auto refresh upon successful connection to the database, now login with the new administrator account created in earlier step.
How to passthrough a PCIe or On-Board device/controller in Proxmox VE v.8.2.4.
At times you might want to passthrough certain devices or controller to a VM Guest for full access and control. This can be a GPU, RAID Controller, NIC etc. This is very useful in scenario such as testing a NAS (TrueNAS).
Pre-requisites :-
1. System CPU must support IOMMU (I/O Memory Management Unit) interrupt remapping. Usually this is called Intel VT-d or AMD-Vi or similar names. Most newer Mainboard and CPU already have such features.
2. This passthrough methods means the entire device or controller is no longer in use by Proxmox VE itself and only manage by the VM Guest. This means you cannot passthrough a controller where the "Boot-Pool" is connected. It must be a separate controller or device.
Scenario :-
My test system or home lab system is a HP Z800 WorkStation series with the following hardware configurations, if your system is newer than mine then most probably it will works too :-
The "LSI 9212-4i SAS/SATA 4-ports PCIe Controller" is where Proxmox VE is installed, thus I cannot passthrough this controller.
Let's Get Started :-
1. Login to the Proxmox VE's WebUI.
2. Select the Node, in this case I have only a single node.
3. Open --> Shell
4. Verify that your system have IOMMU enabled.
dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
The results should shows "DMAR: IOMMU enabled" OR "DMAR: Intel(R) Virtualization Technology for Directed I/O". If either of these is missing then you need to check your BIOS/UEFI whether those virtualization technology are enabled.
5. Edit the "Kernel" file.
nano /etc/kernel/cmdline
Add the following line to the file.
root=ZFS=rpool/ROOT/pve-1 boot=zfs intel_iommu=on
If your CPU is and AMD type, then add "amd_iommu=on" to it.
6. Next is to edit the "Modules" file.
nano /etc/modules
Add the following into the file.
vfio vfio_iommu_type1 vfio_pci vfio_virqfd
7. Now we also need to edit the "GRUB" file.
nano /etc/default/grub
Look for the following line and append the line as shown.
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
If your CPU is and AMD type, then add "amd_iommu=on" to it.
8. Once all done, we need to refresh the "Proxmox" boot.
proxmox-boot-tool refresh
9. Update the "initfamfs" also.
update-initramfs -u -k all
10. Next is to update "GRUB" also.
update-grub
11. Finally, we need to REBOOT the Proxmox VE host server.
12. After reboot, verify the "IOMMU" configuration.
dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
Results :-
DMAR: IOMMU enabled OR DMAR: Intel(R) Virtualization Technology for Directed I/O
13. Verify "vfio" configuration.
lsmod | grep vfio
Results :-
vfio_pci491520
vfio_virqfd163841 vfio_pci
irqbypass 163842 vfio_pci,kvm
vfio_iommu_type1 327680
vfio 327682 vfio_iommu_type1,vfio_pci
14. Verify "Interrupt Remapping" configuration.
dmesg | grep 'remapping'
Results :-
AMD-Vi: Interrupt remapping enabled OR DMAR-IR: Enabled IRQ remapping in 2xapic mode (only for older CPU model)
If you encounter an error message on the remapping interrupts, type the following command and reboot the Proxmox server again.
15. Now you can create a VM and passthrough a PCIe device to that VM. Take note you need to ensure the "Machine = q35" else it will not work.
Also note that the device must not be in the same IOMMU Group, if the device is in the same group of another device then high chances it will not work or the entire group will also be passthrough to the VM.
Piwigo is an Open Source Photo Management Server, it allows you to self-host your very own photo management, organizing and share your photo easily on the web.
<Directory /var/www/html/piwigo/> Options FollowSymlinks AllowOverride All Require all granted <\Directory> <\VirtualHost>
11. Then we need to enable the newly created site.
sudo a2ensite piwigo.conf
12. We also need to enable Apache module as below.
sudo a2enmod rewrite
13. Finally we need to restart Apache Server.
sudo systemctl restart apache2
14. Once done, open any preferred browser and browse to Piwigo site.
http://[IP Address]/piwigo
15. You will need to perform initial configurations of piwigo, enter all the relevant information as required. This includes the Database Name and Credentials, also you will need to create an administrator user (to manage the Piwigo) which are not "Root".
16. Once everything are successfully configured, you will be able to login to the Piwigo site and you can start to create your first album and start uploading photos.
Note : It is recommended to install a Plugin called "Community" which allows your "Users" to create their own albums and upload photos.