How to remove a forwarded port in vagrant?

Member

by dana , in category: Third Party Scripts , 3 months ago

How to remove a forwarded port in vagrant?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by cortez.connelly , 3 months ago

@dana 

To remove a forwarded port in Vagrant, you can update the Vagrantfile configuration and then reload the Vagrant environment.


Here's how you can do it:

  1. Open the Vagrantfile in your project directory.
  2. Locate the line that forwards the port in the configuration block. It should look something like this:
1
config.vm.network "forwarded_port", guest: 80, host: 8080


  1. Comment out or delete the line that forwards the port that you want to remove.
  2. Save the Vagrantfile.
  3. In your terminal, navigate to the project directory where the Vagrantfile is located.
  4. Run the following command to reload the Vagrant environment:
1
vagrant reload


This will apply the changes in the Vagrantfile and remove the forwarded port from the configuration.