Linux

How To Allow Web Access To Your Site Within Your Local Network Using UFW And Ubuntu

Posted by Weston Ganger on March 17, 2016

I like to use my triple monitor desktop config instead of my laptop but I only keep work up to date on my laptop usually so its easier to just SSH in and work from the desktop.


You are required first to enable UFW to be able to recieve incoming HTTP traffic.

Here I describe how to setup UFW to allow incoming ports.


# Turn on the Firewall
sudo ufw enable

# See Firewall Status, including what is denied and allowed
sudo ufw status verbose

# Allow HTTP
sudo ufw allow 80

# Allow Local Rails Dev Port
sudo ufw allow 3000
sudo ufw allow 3001

# Allow SSH
sudo ufw allow 22

# If you want to need to turn it off
sudo ufw disable

I was having trouble with my laptops VPN after enabling the firewall. UFW was causing problems so I just disable it off when I am working from the laptop and want to use my VPN.


I also use guard-rails for my development server setup and I found that the binding defaults to 127.0.0.1 which doesnt play nice with UFW so I set the default binding to 0.0.0.0


# Guardfile

guard :rails, host: '0.0.0.0' do
  # watch stuff
end

Now you can access your development server remotely within the same network at http://192.168.1.:3000 Where 192.168.1.4 is the IP of your remote machine.


Related External Links:


Posted in Linux and Tagged with ubuntu ufw rails guard 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts