📢Crear mi propio SERVIDOR WEB REMOTO desde CASA 🐧 Ubuntu + APACHE

3 min read 6 months ago
Published on Aug 27, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, we will set up a remote web server at home using Ubuntu 20.04 and Apache. This guide will walk you through the necessary steps, including configuring dynamic DNS with No-IP, installing Apache, and ensuring your server is accessible from the internet.

Step 1: Create and Configure Dynamic DNS

To make your home server accessible via a domain name, you'll need to set up dynamic DNS.

  • Go to No-IP.
  • Sign up for an account and create a hostname (e.g., redesplus).
  • Choose the option for Dynamic DNS.

Step 2: Configure Your Computer

Ensure your computer is set up correctly for the server.

  • If using a virtual machine, set the network adapter to "Bridged" mode. This allows your VM to be part of the same network as your host.

Step 3: Verify DNS Resolution

Check that your dynamic DNS is resolving correctly.

  • Open your terminal and execute the following command to check your internet connection:
    networkctl status
    
  • Verify your hostname with:
    nslookup redesplus.ddns.net
    

Step 4: Configure Your Router for Dynamic DNS

You need to configure your router to work with your dynamic DNS service.

  • Access your router settings and locate the section for Dynamic DNS (often called DynDNS).
  • Set up the No-IP client on Ubuntu by following the installation tutorial here: Install No-IP Client.

Step 5: Install Apache

Now, let’s install the Apache web server.

  • Update your package lists:
    sudo apt-get update
    
  • Install Apache:
    sudo apt-get install apache2
    

Step 6: Configure Your Web Page

You can customize your web server's homepage.

  • List the contents of the web directory:
    ls /var/www/html/
    
  • Edit the default index file:
    sudo nano /var/www/html/index.html
    
  • Add your desired HTML content and save the file.

Step 7: Configure Your Router

You must ensure your router forwards traffic correctly to your server.

  • Access your router's NAT settings and add a rule to forward port 80 (HTTP).
  • Check your firewall settings to ensure port 80 is open.
  • To verify that the port is listening, run:
    ss -ltpan
    
  • Use Nmap to check if your server is accessible:
    sudo apt-get install nmap
    nmap redesplus.ddns.net -p 80
    

Step 8: Test Your Server

Finally, confirm that your web server is functioning correctly.

  • Open a web browser and navigate to your dynamic DNS hostname (e.g., http://redesplus.ddns.net).
  • You should see the content of your index.html file.

Conclusion

You have successfully set up a remote web server using Ubuntu and Apache. Key points to remember include configuring dynamic DNS and ensuring your router forwards traffic correctly. For further enhancements, consider exploring additional configurations for security and performance. Happy hosting!