<?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: Code masters</title>
    <description>The latest articles on DEV Community by Code masters (@phcoder05).</description>
    <link>https://dev.to/phcoder05</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%2F1671131%2Ff2cb2b41-5d27-4510-b652-2e3120483fe6.jpeg</url>
      <title>DEV Community: Code masters</title>
      <link>https://dev.to/phcoder05</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phcoder05"/>
    <language>en</language>
    <item>
      <title>How to Set Up a Reverse Proxy with Nginx for Your Backend Application</title>
      <dc:creator>Code masters</dc:creator>
      <pubDate>Tue, 21 Jan 2025 18:23:10 +0000</pubDate>
      <link>https://dev.to/phcoder05/how-to-set-up-a-reverse-proxy-with-nginx-for-your-backend-application-14nk</link>
      <guid>https://dev.to/phcoder05/how-to-set-up-a-reverse-proxy-with-nginx-for-your-backend-application-14nk</guid>
      <description>&lt;p&gt;Setting up a reverse proxy is an essential step for routing traffic from a custom domain to your backend application. This guide provides a general step-by-step process for configuring a reverse proxy using Nginx.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Configure DNS for Your Domain
&lt;/h2&gt;

&lt;p&gt;Begin by setting up the DNS records:&lt;/p&gt;

&lt;p&gt;Access your DNS provider's dashboard (e.g., Namecheap, GoDaddy, Cloudflare).&lt;/p&gt;

&lt;p&gt;Create an A record:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Type:&lt;/strong&gt; A Record&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Name:&lt;/strong&gt; Subdomain (e.g., "api")&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value:&lt;/strong&gt; Your server’s public IP address&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TTL:&lt;/strong&gt; Automatic or 3600 seconds (1 hour)&lt;/p&gt;

&lt;p&gt;Wait for DNS propagation, which can take up to 24 hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Install Nginx on Your Server
&lt;/h2&gt;

&lt;p&gt;If Nginx is not already installed, follow these steps:&lt;br&gt;
&lt;code&gt;sudo apt update&lt;br&gt;
sudo apt install nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Check if Nginx is running:&lt;br&gt;
&lt;code&gt;sudo systemctl status nginx&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Configure Nginx as a Reverse Proxy
&lt;/h2&gt;

&lt;p&gt;1.Open a new Nginx configuration file for your domain or subdomain:&lt;br&gt;
&lt;code&gt;sudo nano /etc/nginx/sites-available/your-subdomain&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2.Add the following configuration:&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 your-subdomain.example.com;

    location / {
        proxy_pass http://localhost:your-backend-port;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    error_log /var/log/nginx/backend_error.log;
    access_log /var/log/nginx/backend_access.log;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.Save and exit the file&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;listen 80;&lt;/em&gt; tells Nginx to listen on port 80.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;_server_name _your-subdomain.example.com; specifies the domain name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;proxy_pass&lt;/em&gt; forwards requests to the backend application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Additional &lt;em&gt;proxy_set_header&lt;/em&gt; directives ensure proper header forwarding.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Enable the Nginx Site Configuration
&lt;/h2&gt;

&lt;p&gt;Create a symbolic link to enable the site configuration:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ln -s /etc/nginx/sites-available/your-subdomain /etc/nginx/sites-enabled/&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Test the Nginx Configuration
&lt;/h2&gt;

&lt;p&gt;Verify the syntax of the Nginx configuration:&lt;/p&gt;

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

&lt;p&gt;If successful, you should see:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nginx: configuration file /etc/nginx/nginx.conf test is successful&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Restart Nginx
&lt;/h2&gt;

&lt;p&gt;Restart Nginx to apply the changes:&lt;/p&gt;

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

&lt;h2&gt;
  
  
  7. Secure the Connection with SSL (Optional but Recommended)
&lt;/h2&gt;

&lt;p&gt;For a secure HTTPS connection, use Certbot to obtain a free SSL certificate:&lt;/p&gt;

&lt;p&gt;Install Certbot and the Nginx plugin:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install certbot python3-certbot-nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Obtain an SSL certificate for your domain:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo certbot --nginx -d your-subdomain.example.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Follow the prompts to complete the SSL setup. Certbot will update your Nginx configuration to redirect HTTP to HTTPS automatically.&lt;/p&gt;

&lt;p&gt;Verify the certificate renewal process:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo certbot renew --dry-run&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Verify the Setup
&lt;/h2&gt;

&lt;p&gt;Access your backend application through the configured domain or subdomain:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://your-subdomain.example.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If the site is not working, check the Nginx logs for errors:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo tail -f /var/log/nginx/backend_error.log&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By following these steps, you’ve successfully configured Nginx as a reverse proxy for your backend application. This setup ensures that traffic to your domain or subdomain is routed securely and efficiently, providing a professional and reliable user experience.&lt;/p&gt;

</description>
      <category>proxy</category>
      <category>reverseproxy</category>
      <category>nginxsetup</category>
      <category>backenddevelopment</category>
    </item>
    <item>
      <title>responsive join group buttons</title>
      <dc:creator>Code masters</dc:creator>
      <pubDate>Sat, 27 Jul 2024 15:04:43 +0000</pubDate>
      <link>https://dev.to/phcoder05/responsive-join-group-buttons-1n8k</link>
      <guid>https://dev.to/phcoder05/responsive-join-group-buttons-1n8k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Check out this Pen I made!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Pankaj_0512/embed/zYVoPPo?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>webdev</category>
      <category>pankajhadole</category>
    </item>
  </channel>
</rss>
