<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Injamul Mohammad Mollah on Medium]]></title>
        <description><![CDATA[Stories by Injamul Mohammad Mollah on Medium]]></description>
        <link>https://medium.com/@mrinjamul?source=rss-fd9c086e97fd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cTcuhZZlQy4lGdHm7JTggg.png</url>
            <title>Stories by Injamul Mohammad Mollah on Medium</title>
            <link>https://medium.com/@mrinjamul?source=rss-fd9c086e97fd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:01:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mrinjamul/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Set Up Authelia with Nginx Proxy Manager for Secure SSO Authentication]]></title>
            <link>https://medium.com/tech-thinker/how-to-set-up-authelia-with-nginx-proxy-manager-for-secure-sso-authentication-364c4d490dbd?source=rss-fd9c086e97fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/364c4d490dbd</guid>
            <category><![CDATA[authelia]]></category>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[nginx-proxy]]></category>
            <dc:creator><![CDATA[Injamul Mohammad Mollah]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 08:00:56 GMT</pubDate>
            <atom:updated>2025-10-01T09:29:51.434Z</atom:updated>
            <content:encoded><![CDATA[<p>Authelia is an open-source authentication and authorization server that adds 2FA, SSO, and access policies to your self-hosted services. In this guide, we walk through integrating Authelia with Nginx Proxy Manager (NPM) using Docker and reusable Nginx snippets for consistent and secure authentication.</p><h3>Prerequisites</h3><ul><li>Docker and Docker Compose are installed</li><li>A domain (e.g., yourdomain.com) with DNS pointed to your server</li><li>SMTP credentials for notifications</li><li>Basic understanding of Docker networking and reverse proxies</li></ul><h3>STEP 1: Set Up Shared Docker Network</h3><pre>docker network create --driver bridge subnet</pre><p>Nginx Proxy Manager, Authelia, and any protected applications will share this network.</p><h3>STEP 2: Deploy Nginx Proxy Manager (NPM)</h3><pre>services:<br>  app:<br>    image: jc21/nginx-proxy-manager:2.12.6<br>    restart: unless-stopped<br>    networks:<br>      subnet:<br>        aliases: []<br>    ports:<br>      - 80:80<br>      - 443:443<br>      - 81:81<br>    volumes:<br>      - ${DATA_LOCATION}/data:/data<br>      - ${DATA_LOCATION}/letsencrypt:/etc/letsencrypt<br>      - ${DATA_LOCATION}/snippets:/snippets<br>networks:<br>  subnet:<br>    external: true</pre><p>This mounts a snippets folder where you’ll place Nginx include files used by Authelia.</p><p>Set DATA_LOCATION in .env as your preferred location for data. For me, it is /srv/npm</p><p>After this, start the nginx proxy manager using,</p><p>docker compose up -d</p><p>Visit http://localhost:81 and set up nginx proxy manager. Default email is admin@example.com and password is changeme . Change the password at first login.</p><h3>STEP 3: Create Nginx Snippets</h3><p>Save these in your snippets directory:</p><h3>proxy.conf</h3><pre>proxy_set_header Host $host;<br>proxy_set_header X-Original-URL $scheme://$http_host$request_uri;<br>proxy_set_header X-Forwarded-Proto $scheme;<br>proxy_set_header X-Forwarded-Host $http_host;<br>proxy_set_header X-Forwarded-URI $request_uri;<br>proxy_set_header X-Forwarded-Ssl on;<br>proxy_set_header X-Forwarded-For $remote_addr;<br>proxy_set_header X-Real-IP $remote_addr;<br>client_body_buffer_size 128k;<br>proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;<br>proxy_redirect http:// $scheme://;<br>proxy_http_version 1.1;<br>proxy_cache_bypass $cookie_session;<br>proxy_no_cache $cookie_session;<br>proxy_buffers 64 256k;<br>real_ip_header X-Forwarded-For;<br>real_ip_recursive on;<br>send_timeout 5m;<br>proxy_read_timeout 360;<br>proxy_send_timeout 360;<br>proxy_connect_timeout 360;</pre><h3>websocket.conf</h3><pre>proxy_set_header Upgrade $http_upgrade;<br>proxy_set_header Connection &quot;upgrade&quot;;</pre><h3>authelia-location.conf</h3><pre>set $upstream_authelia http://authelia:9091/api/authz/auth-request;<br>location /internal/authelia/authz {<br>    internal;<br>    proxy_pass $upstream_authelia;<br>    proxy_set_header X-Original-Method $request_method;<br>    proxy_set_header X-Original-URL $scheme://$http_host$request_uri;<br>    proxy_set_header X-Forwarded-For $remote_addr;<br>    proxy_set_header Content-Length &quot;&quot;;<br>    proxy_set_header Connection &quot;&quot;;<br>    proxy_pass_request_body off;<br>    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;<br>    proxy_redirect http:// $scheme://;<br>    proxy_http_version 1.1;<br>    proxy_cache_bypass $cookie_session;<br>    proxy_no_cache $cookie_session;<br>    proxy_buffers 4 32k;<br>    client_body_buffer_size 128k;<br>    send_timeout 5m;<br>    proxy_read_timeout 240;<br>    proxy_send_timeout 240;<br>    proxy_connect_timeout 240;<br>}</pre><h3>authelia-authrequest.conf</h3><pre>## Send a subrequest to Authelia to verify if the user is authenticated and has permission to access the resource.<br>auth_request /internal/authelia/authz;<br>## Save the upstream metadata response headers from Authelia to variables.<br>auth_request_set $user $upstream_http_remote_user;<br>auth_request_set $groups $upstream_http_remote_groups;<br>auth_request_set $name $upstream_http_remote_name;<br>auth_request_set $email $upstream_http_remote_email;<br>## Inject the metadata response headers from the variables into the request made to the backend.<br>proxy_set_header Remote-User $user;<br>proxy_set_header Remote-Groups $groups;<br>proxy_set_header Remote-Email $email;<br>proxy_set_header Remote-Name $name;<br>## Configure the redirection when the authz failure occurs. Lines starting with &#39;Modern Method&#39; and &#39;Legacy Method&#39;<br>## should be commented / uncommented as pairs. The modern method uses the session cookies configuration&#39;s authelia_url<br>## value to determine the redirection URL here. It&#39;s much simpler and compatible with the mutli-cookie domain easily.<br>## Modern Method: Set the $redirection_url to the Location header of the response to the Authz endpoint.<br>auth_request_set $redirection_url $upstream_http_location;<br>## Modern Method: When there is a 401 response code from the authz endpoint redirect to the $redirection_url.<br>error_page 401 =302 $redirection_url;<br>## Legacy Method: Set $target_url to the original requested URL.<br>## This requires http_set_misc module, replace &#39;set_escape_uri&#39; with &#39;set&#39; if you don&#39;t have this module.<br># set_escape_uri $target_url $scheme://$http_host$request_uri;<br>## Legacy Method: When there is a 401 response code from the authz endpoint redirect to the portal with the &#39;rd&#39;<br>## URL parameter set to $target_url. This requires users update &#39;auth.yourdomain.com/&#39; with their external authelia URL.<br># error_page 401 =302 https://auth.yourdomain.com/?rd=$target_url;</pre><p>For reference, you can also follow this: <a href="https://www.authelia.com/integration/proxies/nginx/#supporting-configuration-snippets">https://www.authelia.com/integration/proxies/nginx/#supporting-configuration-snippets</a></p><p>After configuring snippets,</p><p>Restart the nginx proxy manager container,</p><p>docker compose restart</p><h3>STEP 4: Deploy Authelia + Whoami for Testing</h3><pre>services:<br>  authelia:<br>    image: authelia/authelia:latest<br>    container_name: authelia<br>    restart: unless-stopped<br>    networks:<br>      subnet:<br>        aliases: []<br>    ports:<br>      - 9091:9091<br>    volumes:<br>      - ${AUTHELIA_CONFIG}/config:/config<br>    environment:<br>      TZ: ${TZ}<br>  whoami:<br>    image: traefik/whoami<br>    container_name: whoami<br>    restart: unless-stopped<br>    networks:<br>      subnet:<br>        aliases: []<br>    ports:<br>      - 9092:80<br>    environment:<br>      TZ: ${TZ}<br>networks:<br>  subnet:<br>    external: true</pre><p>Start these containers by,</p><p>docker compose up -d</p><h3>STEP 5: Configure Authelia</h3><h3>users_database.yml</h3><pre>users:<br>  authelia:<br>    displayname: &quot;Test&quot;<br>    password: &quot;$argon2id$...&quot;  # Use hash generated with CLI<br>    email: user@example.com<br>    groups:<br>      - admins<br>      - dev</pre><p>Generate password hash:</p><pre>docker exec -it authelia authelia crypto hash generate argon2<br>or<br>docker run -it authelia/authelia:latest authelia crypto hash generate argon2</pre><h3>configuration.yml</h3><p>The default configuration file is quite extensive, so I won’t include the entire content here. Instead, I’ll highlight only the key variables you need to set or modify to get Authelia working properly.</p><pre>theme: &#39;auto&#39;</pre><pre>identity_validation:<br>  reset_password:<br>    jwt_secret: &#39;replace-with-openssl-output&#39;</pre><pre>authentication_backend:<br>  file:<br>    path: &#39;/config/users_database.yml&#39;</pre><pre>access_control:<br>  default_policy: &#39;deny&#39;<br>  rules:<br>    - domain: &#39;*.yourdomain.com&#39;<br>      policy: &#39;one_factor&#39;</pre><pre>session:<br>  secret: &#39;replace-with-openssl-output&#39;<br>  cookies:<br>    - name: &#39;authelia_session&#39;<br>      domain: &#39;yourdomain.com&#39;<br>      authelia_url: &#39;https://auth.yourdomain.com&#39;<br>      inactivity: &#39;5 minutes&#39;<br>      expiration: &#39;1 hour&#39;<br>      remember_me: &#39;1 month&#39;</pre><pre>storage:<br>  encryption_key: &#39;replace-with-openssl-output&#39;<br>  local:<br>    path: &#39;/config/db.sqlite3&#39;</pre><pre>notifier:<br>  smtp:<br>    address: &#39;smtp://smtp.gmail.com:587&#39;<br>    username: &#39;your-email@gmail.com&#39;<br>    password: &#39;your-app-password&#39;<br>    sender: &#39;Authelia &lt;admin@yourdomain.com&gt;&#39;<br>    subject: &#39;[Authelia] {title}&#39;<br>    startup_check_address: &#39;your-email@gmail.com&#39;</pre><p>You can use the file-based notifier, but it’s not practical for everyday use. Especially since you won’t be able to receive OTPs for actions like password resets.</p><p>To generate secrets:</p><pre>openssl rand -base64 32</pre><p>After configuring Authelia, restart the container by,</p><p>docker restart authelia</p><p>Bonus:</p><p>You can also rate limit a user to a maximum number of password retries. Set up this config in Authelia.</p><pre>regulation:<br>  ## Regulation Mode.<br>  modes:<br>    - &#39;user&#39;<br>  ## The number of failed login attempts before user is banned. Set it to 0 to disable regulation.<br>  max_retries: 3<br><br>  ## The time range during which the user can attempt login before being banned in the duration common syntax. The user<br>  ## is banned if the authentication failed &#39;max_retries&#39; times in a &#39;find_time&#39; seconds window.<br>  find_time: &#39;2 minutes&#39;<br><br>  ## The length of time before a banned user can login again in the duration common syntax.<br>  ban_time: &#39;5 minutes&#39;</pre><h3>STEP 6: Add Authelia to NPM as a Proxy Host</h3><p>Create a <strong>new proxy host</strong> in NPM:</p><ul><li><strong>Domain</strong>: auth.yourdomain.com</li><li><strong>Scheme</strong>: http</li><li><strong>Forward Hostname/IP</strong>: authelia</li><li><strong>Forward Port</strong>: 9091</li></ul><p>SSL tab:</p><ul><li>Request a valid SSL certificate</li><li>Enable <strong>Force SSL</strong></li></ul><p>Advanced tab:</p><pre>location / {<br>    include /snippets/proxy.conf;<br>    proxy_pass $forward_scheme://$server:$port;<br>}</pre><h3>STEP 7: Protect an Application (e.g., Nextcloud)</h3><p>Create another <strong>proxy host</strong>:</p><ul><li><strong>Domain</strong>: nextcloud.yourdomain.com</li><li><strong>Scheme</strong>: http</li><li><strong>Forward Hostname/IP</strong>: nextcloud</li><li><strong>Forward Port</strong>: 80</li></ul><p>SSL tab:</p><ul><li>Request a valid SSL certificate</li><li>Force SSL</li></ul><p>Advanced tab:</p><pre>include /snippets/authelia-location.conf;<br>location / {<br>    include /snippets/proxy.conf;<br>    include /snippets/websocket.conf;<br>    include /snippets/authelia-authrequest.conf;<br>    proxy_pass $forward_scheme://$server:$port;<br>}</pre><p>Voila!</p><p>Now you can visit your app https://yourapp.yourdomain.com and see being redirected to the Authelia login page.</p><p><strong>Summary:</strong></p><p>You now have:</p><ul><li>NPM reverse proxy with Authelia enforcement</li><li>Protected apps with optional WebSocket support</li><li>2FA and access policies per app</li></ul><p>Test it using the Whoami container before protecting production services.</p><blockquote><strong><em>Note:</em></strong><em> Always replace placeholder values like </em><em>yourdomain.com, emails, secrets, and hashed passwords with secure values specific to your setup.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=364c4d490dbd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tech-thinker/how-to-set-up-authelia-with-nginx-proxy-manager-for-secure-sso-authentication-364c4d490dbd">How to Set Up Authelia with Nginx Proxy Manager for Secure SSO Authentication</a> was originally published in <a href="https://medium.com/tech-thinker">Tech Thinker</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up a Private Search Engine (SearxNG) for LLM Web Search]]></title>
            <link>https://medium.com/tech-thinker/how-to-set-up-a-private-search-engine-searxng-for-llm-web-search-384d13c53cdb?source=rss-fd9c086e97fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/384d13c53cdb</guid>
            <category><![CDATA[self-hosted]]></category>
            <category><![CDATA[search-engines]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Injamul Mohammad Mollah]]></dc:creator>
            <pubDate>Tue, 05 Aug 2025 15:51:37 GMT</pubDate>
            <atom:updated>2025-08-05T15:51:37.145Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you looking for a private, self-hosted search engine that protects user privacy and can be integrated into your local LLM application’s web search? SearxNG is a modern, feature-rich fork of Searx, designed for exactly this purpose. In this guide, we’ll walk you through deploying SearxNG using Docker with the provided configuration.</p><h3>Why Choose SearxNG?</h3><ul><li>Privacy: Your searches stay local — nothing is tracked or profiled.</li><li>Customizable: Integrate with various search backends (Bing, Google, DuckDuckGo, etc.).</li><li>Compatible: Perfect for powering web search capabilities in LLMs (like private ChatGPT or other open-source AI tools).</li></ul><h3>1. Create Directories for SearxNG</h3><pre>sudo mkdir -p /srv/searxng/config /srv/searxng/data</pre><h3>2. Create Docker compose</h3><p>Create docker-compose.yml using the following content:</p><pre>services:<br>  searxng:<br>    image: docker.io/searxng/searxng:latest<br>    container_name: searxng<br>    restart: always<br>    ports:<br>      - 8888:8080<br>    volumes:<br>      - /srv/searxng/config/:/etc/searxng/<br>      - /srv/searxng/data/:/var/cache/searxng/<br>networks: {}</pre><h3>3. Customize SearxNG (Optional but Recommended)</h3><p>On the first run, SearxNG will create a default configuration. You can customize search backends, themes, and behaviors by editing /srv/searxng/config/settings.yaml once it&#39;s been generated.</p><ul><li>Start SearxNG first (step 4), then edit the config file.</li><li>For private LLM use, ensure that “SafeSearch” is set according to your needs and unwanted result engines are disabled.</li></ul><h3>4. Start the Container</h3><pre>docker compose up -d</pre><p>This will start SearxNG in detached mode.</p><p>Visit <a href="http://localhost:8888/">http://localhost:8888</a> in your browser.</p><h3>Enable Autocomplete with a Provider</h3><p>Locate (or add) the search: section in your settings.yml and set autocomplete to the provider of your choice (e.g., &quot;google&quot; or &quot;duckduckgo&quot;).</p><p>Example:</p><pre>  ...<br>  # Existing autocomplete backends: &quot;360search&quot;, &quot;baidu&quot;, &quot;brave&quot;, &quot;dbpedia&quot;, &quot;duckduckgo&quot;, &quot;google&quot;, &quot;yandex&quot;,<br>  # &quot;mwmbl&quot;, &quot;naver&quot;, &quot;seznam&quot;, &quot;sogou&quot;, &quot;startpage&quot;, &quot;stract&quot;, &quot;swisscows&quot;, &quot;quark&quot;, &quot;qwant&quot;, &quot;wikipedia&quot; -<br>  # leave blank to turn it off by default.<br>  autocomplete: &quot;google&quot;<br>  ...</pre><p>Tip: DuckDuckGo is reliable and widely used, but Google can be used if supported and desired</p><h3>Enable JSON Output Format</h3><p>In the same search: section, add json to the formats: List so that SearxNG can output API responses in JSON format:</p><pre>...<br>  # remove format to deny access, use lower case.<br>  # formats: [html, csv, json, rss]<br>  formats:<br>    - html<br>    - json<br>...</pre><p>This enables responses to /search?q=...&amp;format=json for LLMs or programmatic access.</p><h3>Apply Changes</h3><p>After editing your configuration file, you must restart your Docker container to apply changes:</p><pre>docker restart searxng</pre><p>SearxNG empowers you to keep your queries private and flexible, ensuring your LLM web search is ethical, secure, and fully under your control. Happy searching!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=384d13c53cdb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tech-thinker/how-to-set-up-a-private-search-engine-searxng-for-llm-web-search-384d13c53cdb">How to Set Up a Private Search Engine (SearxNG) for LLM Web Search</a> was originally published in <a href="https://medium.com/tech-thinker">Tech Thinker</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A bit about my journey (Arch Linux)]]></title>
            <link>https://mrinjamul.medium.com/a-bit-about-my-journey-arch-linux-872090bc9bf9?source=rss-fd9c086e97fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/872090bc9bf9</guid>
            <category><![CDATA[hobby]]></category>
            <category><![CDATA[arch]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Injamul Mohammad Mollah]]></dc:creator>
            <pubDate>Mon, 22 Nov 2021 15:56:08 GMT</pubDate>
            <atom:updated>2021-11-22T15:56:08.502Z</atom:updated>
            <content:encoded><![CDATA[<p>For most of my life with computers, I have used Linux. Windows was great but I decided to use Ubuntu. I tried out all sorts of Linux distros (ie. Elementary OS, Linux Mint, etc) but none of them seemed right for me. After doing some searching around and I came to the conclusion that I had to attempt to use a minimal Linux distro that is Arch Linux.</p><h4>About My Computer and What I do on it</h4><p>Hardware: The PC I mainly use is a laptop that I got a few years back with a<br> Intel Core i3 3rd Gen, and 10 GB of RAM. <br> <br> Usage: On my computer, I mainly write code using a text editor (i.e. vim or <br> somethings for quick use nano) and browse the web.</p><h4>The Installation</h4><p>Getting Arch Linux up and running on your computer really isn’t that bad. <br> Arch has great <a href="https://www.archlinux.org/">documentation</a> and the <a href="https://wiki.archlinux.org/index.php/beginners&#39;_guide">beginner’s <br> guide</a> makes everything<br> very straightforward. It took me around an hour to get a stable desktop <br> environment (it’s very easy installation) once I got all the basic stuff <br> taken care of I was finally able to begin making the operating system I <br> really wanted.</p><h4>So Why use Arch?</h4><p>I prefer Arch over other Linux distros or any operating system for that <br> matter: <br> <br> • All I needs is a terminal with some GUI applications <br> • The best performance <br> • I choose what’s installed <br> • Fully customizable (almost) <br> • Always the latest software <br> • Installing software is easy with <em>pacman</em> <br> • Very intelligent community <br> • Teaches you about how Linux works</p><h4>Conclusion</h4><p>I really do see myself sticking with Arch for quite some time. With its <br> rolling releases there will be no need to ever have to install any major <br> updates and I have everything I really need on a computer.</p><blockquote>PS: Gentoo Linux also better but I don’t have the time to configure and compile it.</blockquote><h4>What’s on my PC</h4><p>Here’s a shortlist of things I have installed on my main Arch Linux <br> computer.<br> <br> • <a href="https://dwm.suckless.org/">dwm</a> with custom configurations <br> • <a href="https://st.suckless.org/">st</a> or <a href="https://github.com/alacritty/alacritty">alacritty</a><br> • <a href="https://github.com/tmux/tmux">tmux</a><br> • <a href="https://www.vim.org/">vim</a> but Now I’m using <a href="https://neovim.io/">nvim</a> with my <a href="https://github.com/mrinjamul/vim-in">configs</a><br> • <a href="https://ohmyz.sh/">oh my zsh <br></a> • <a href="https://www.mozilla.org/en-US/firefox/">firefox</a><br> • <a href="https://mpv.io/">mp</a>v</p><p><em>Originally published at </em><a href="https://mrinjamul.is-a.dev/blog"><em>https://mrinjamul.is-a.dev</em></a>/blog</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=872090bc9bf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create and manage services in Termux (Linux-based Android Terminal)]]></title>
            <link>https://mrinjamul.medium.com/create-and-manage-services-in-termux-linux-based-android-terminal-5120c4694199?source=rss-fd9c086e97fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/5120c4694199</guid>
            <category><![CDATA[termux]]></category>
            <category><![CDATA[command-line-interface]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Injamul Mohammad Mollah]]></dc:creator>
            <pubDate>Tue, 09 Feb 2021 14:30:33 GMT</pubDate>
            <atom:updated>2021-11-22T15:35:33.698Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Termux</strong> is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required.</blockquote><p>Today, I will show you how to create and manage services in termux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*2C5IHPAd2RlWoCDjIgYUwA.png" /></figure><p>Termux uses runit as its init system.</p><blockquote>“<strong><em>runit</em></strong> is a cross-platform Unix init scheme with service supervision, a replacement for sysvinit, and other init schemes.”</blockquote><p>First, To use Termux services, you need to install the service package.</p><pre>pkg install termux-services</pre><p>then restart termux so that the service daemon is started.</p><p>Now let&#39;s create a service,</p><p>I am going to create a service for <a href="https://github.com/gogs/gogs">gogs</a>(a git service).</p><p>All termux services are located at $PREFIX/var/service ($PREFIX=$HOME/../usr).</p><p>create a folder for the service and name as the application name. In my case that is gogs .</p><pre>mkdir $PREFIX/var/service/gogs</pre><p>then link the termux-logger.</p><pre>mkdir $PREFIX/var/service/gogs/log</pre><pre>ln -sf $PREFIX/share/termux-services/svlogger $PREFIX/service/gogs/log/run</pre><p>Now write the service file for the application with the below content,</p><pre>touch $PREFIX/var/service/gogs/run</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/418eeefde5a9cc84b4c37ec0b169f7a5/href">https://medium.com/media/418eeefde5a9cc84b4c37ec0b169f7a5/href</a></iframe><p>You can get help to write <strong>runit</strong> service <a href="http://smarden.org/runit/">here</a>.</p><p>make it executable,</p><pre>chmod +x $PREFIX/var/service/gogs/run</pre><p>Now restart Termux and run,</p><pre>sv up gogs</pre><p>It will work smoothly.</p><p>Here are some useful commands about termux services,</p><p>To enable service to start at boot,</p><pre>sv-enable &lt;service&gt;</pre><p>To disable from starting at boot,</p><pre>sv-disable &lt;service&gt;</pre><p>To start a service,</p><pre>sv up &lt;service&gt;</pre><p>To stop a service,</p><pre>sv down &lt;service&gt;</pre><h3>Bonus Topic: Manage proot(s) in Termux,</h3><p>You can install multiple Linux based distributions using proot-distro ,</p><p>Lists supported distributions and their installation status,</p><pre>proot-distro list</pre><p>To install a distribution,</p><pre>proot-distro install &lt;distro name&gt;</pre><p>To login into a distribution,</p><pre>proot-distro login &lt;distro name&gt;</pre><p>Delete a distribution from Termux,</p><pre>proot-distro remove &lt;distro name&gt; </pre><p>To reinstall a specified distribution,</p><pre>proot-distro reset &lt;distro name&gt;</pre><p>To backup a distribution,</p><pre>proot-distro backup &lt;distro name&gt;</pre><p>To restore a distribution from backup,</p><pre>proot-distro restore &lt;distro name&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5120c4694199" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>