Jump to content

Search the Community

Showing results for tags 'ports'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

There are no results to display.

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


LinkedIn Profile URL


About Me


Cloud Platforms


Cloud Experience


Development Experience


Current Role


Skills


Certifications


Favourite Tools


Interests

Found 2 results

  1. I am running my app on 10.3.23.23:3000 but the i would like to access at 80 port instead 3000 but the same time i dont want to change app config. what are ohter ways we have If you want your application to be accessible on port 80 without changing its configuration (which currently runs on port 3000), you can use a reverse proxy or port forwarding. These methods allow you to keep your application running on its original port while externally it appears to be running on port 80. Here are a few approaches: 1. Using a Reverse Proxy A reverse proxy server sits in front of your application and forwards client requests to the application backend. This is a common way to expose applications running on non-standard ports to standard ports like 80 (HTTP) or 443 (HTTPS). Nginx Here’s an example configuration for Nginx. If you don’t have Nginx installed, you’ll need to install it first. After configuring, restart or reload Nginx for the changes to take effect. Apache If you’re using Apache as a web server, you can configure it to act as a proxy using mod_proxy and mod_proxy_http. Here’s an example configuration: Ensure that mod_proxy and mod_proxy_http are enabled, then restart Apache. 2. Using iptables for Port Forwarding If you’re running a Linux server and prefer not to use a reverse proxy, you can use iptables for port forwarding. This method routes traffic coming into port 80 to port 3000. Here’s how to forward port 80 to port 3000 using iptables: To make the rule persistent across reboots, you’ll need to install iptables-persistent or manually add the rule to your startup scripts, depending on your Linux distribution. $ sudo apt-get update $ sudo apt-get install iptables-persistent $ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000 Save Your Rules Manually: If you've already installed iptables-persistent or if you need to save new rules after installation, you can save your current iptables rules by executing: $ sudo netfilter-persistent save 3. Using a Load Balancer If you’re deploying your application in a cloud environment (like AWS, GCP, Azure), you can use their load balancer services to forward traffic from port 80 to port 3000. You’ll need to set up a load balancer, point it to your application, and configure the listeners to forward traffic from port 80 to port 3000. This approach also gives you the benefit of scaling, SSL termination, and more, depending on the cloud provider’s offerings. Each of these methods allows you to expose your application on port 80 without changing the application’s configuration. Choose the one that best fits your environment and needs. The post How to migrate all the traffic from one to another port appeared first on DevOpsSchool.com. View the full article
  2. Docker compose is a core component of Docker that is frequently utilized to configure the application executed on multiple containers. Docker-compose is mostly utilized to configure the services of containers in the “YAML” file. Different keys are used in the service configuration, “expose” and “ports” are specifically utilized to specify the exposing port for containers. This write-up will explain the difference between the ports and expose key in Docker compose. Difference Between Expose and Ports in Docker Compose The “expose” and “ports” keys in Docker compose are utilized to configure the network and the exposing ports for the container. However, both keys are used for the same purpose, but the key difference between the “ports” and “expose” is that the expose key is accessible to the services that are connected to the same network but not on the host. In contrast, ports are accessible and published on the host as well as on the connected network. Checking the Difference Between “expose” and “ports” Keys in Docker-compose Practically To check the difference between expose and ports key practically, go through the listed examples: Utilize “ports” Key in Docker-Compose File Utilize “expose” Key in Docker-Compose File Example 1: Utilize “ports” Key in Docker-Compose File The “ports” key is utilized to publish the container on the host machine. These containers are accessible to all services that are executing on the host as well on a connected network. To use the “ports” key in Docker compose, check out the given instructions. Step 1: Create a “docker-compose.yml” Make a “docker-compose.yml” file and paste the below code block into the file: version: "3" services: web: image: nginx:latest ports: - 8080:80 According to the above snippet: “web” service is configured in the “docker-compose.yml” file. “image” defines the base image for the compose container “ports” specify the exposing port of the container on a network and host: Step 2: Start Containers Next, create and fire up the compose container with the help of “docker-compose up” command: > docker-compose up -d Step 3: List Compose Container List the container and verify the exposing port of the container. From the output, it can observe that we have published the container on the host: > docker-compose ps Example 2: Utilize “expose” Key in Docker-Compose File To utilize the expose key in the “docker-compose.yml” file, take a look at provided instructions. Step 1: Create a “docker-compose.yml” Now, configure the “web” service on exposing port 80 with the help of the “expose” key. Here, we have not defined any network for the container: version: "3" services: web: image: nginx:latest expose: - 8080:80 Step 2: Fire up the Container Next, create and start the compose container to run web service using the provided command: > docker-compose up -d Step 3: List Compose Container List the compose container and check the exposing port of the container. From the below output, you can observe that the container is accessible only on port 80 on a default selected network but not on host: > docker-compose ps We have defined the distinction of “expose” and “ports” keys in Docker compose. Conclusion The “expose” and “ports” are both used to specify the exposing port of the container to run defined services. The major difference between these two keys is that “ports” is published and accessible on the host machine and also on the specified network, while “expose” is only published on the defined network and accessed by services that are running on the same network. This write-up demonstrated the distinction between “ports” and “expose” in Docker compose. View the full article
  • Forum Statistics

    63.7k
    Total Topics
    61.7k
    Total Posts
×
×
  • Create New...