In reality you probably don’t want to host you websites on your local computer unless you have a very good computer, a very good internet connection and you are an expert system administrator, but this is very useful to learn how the internet works.

In this case I am doing this because I want to be able to develop on my computer no matter where I am. So I want to be able to SSH to my machine, modify my files and view my changes from a web browser. Here are the things that need to be done:

  • Setup a local HTTP server
  • Allow inbound traffic on port 80
  • Setup a free DNS service
  • Setup an SSH server
  • Forward requests to port 22 on your router to your computer

Set up a local HTTP server

I already wrote an article explaining how to do this: Creating local virtual hosts with Apache

Allow inbound traffic on port 80

To make your HTTP server available from the Internet you have to configure your router to send all incoming traffic on port 80 to your computer. The way to do this varies depending you router and ISP, but the steps are very similar most of the time:

  • Go to your router configuration page on a web browser. A lot of times it is http://192.168.1.254/ or http://192.168.1.1/
  • Go to firewall or DMZ setting
  • There will probably be a section that says something similar to: “Allow device application traffic to pass through firewal” Then:
    • Choose your computer
    • Forward external TCP traffic on port 80 (If you are asked for a range choose 80 to 80) to port 80
    • Save

To test that everything went well you can search for “my ip” on Google and it will give you your public IP address. You can give this IP address to anyone and they will see you local server.

Set up free DNS service

Since most internet providers give their customers a dynamic IP address it is not efficient to access your computer that using that number, since it may change at any time. Luckily there are some free services that allow to overcome this issue.

I found https://www.changeip.com/ did the job for me. You just have to click on “Free DNS” and they will let you choose a free subdomain. Then you just have to register and they will automatically detect your public IP. Now anyone can access your local server using that subdomain.

Set up an SSH server

An SSH server makes your computer available via a terminal to other computers using an SSH client. You can install an SSH server on Ubuntu with this command:

1
sudo apt-get install openssh-server

Once the server is installed you can test it by trying to connect to it.

1
ssh yourname@127.0.0.1

When prompted for a password enter your login password.

Forward requests to port 22 on your router to your computer

You can follow the same procedure you used for port 80, just change it port 22. Now you can ssh to your machine using the subdomain you choose for your server.

Making your local server accessible from anywhere的更多相关文章

  1. 分布式TensorFlow集群local server使用详解

    通过local server理解分布式TensorFlow集群的应用与实现. ​​简介 TensorFlow从0.8版本开始,支持分布式集群,并且自带了local server方便测试. Local ...

  2. ArcGIS for Server新建站点异常,Failed to create the site.Failed to configure the server machine'XXXX',Server machine'XXXX' is not a local server machine.

      系统环境:操作系统Win7 64位,装在虚拟机VM中,ArcGIS for Server 10.2.1 问题描述:ArcGIS for Server 10.2.1安装并授权完成后,站点初始化时显示 ...

  3. Golang : Forwarding a local port to a remote server example

    原文:https://socketloop.com/tutorials/golang-forwarding-a-local-port-to-a-remote-server-example 端口转发, ...

  4. SQL Server 常用内置函数(built-in)持续整理

    本文用于收集在运维中经常使用的系统内置函数,持续整理中 一,常用Metadata函数 1,查看数据库的ID和Name db_id(‘DB Name’),db_name('DB ID') 2,查看对象的 ...

  5. Distributed3:SQL Server 创建分布式数据库

    分布式数据库的优势是将IO分散在不同的Physical Disk上,每次查询都由多台Server的CPU,I/O共同负载,通过各节点并行处理数据来提高性能,劣势是消耗大量的网络带宽资源,管理难度大.在 ...

  6. Oracle Database Server 'TNS Listener'远程数据投毒漏洞(CVE-2012-1675)解决

    环境:Windows 2008 R2 + Oracle 10.2.0.3 应用最新bundle patch后,扫描依然报出漏洞 Oracle Database Server 'TNS Listener ...

  7. Runtime Error---Description: An application error occurred on the server....

    [原]Runtime Error---Description: An application error occurred on the server.... 2010-1-7阅读2010 评论3 D ...

  8. 如何使官方提供的AppRTCDemo 运行在自己搭建的server(官方提供的apprtc)上(官方的server源码)

    原文转自 http://stackoverflow.com/questions/21085261/apprtcdemo-with-local-server-works-between-browsers ...

  9. Virgo Tomcat Server 指南-Hello World

    Eclipse发布了最新的Virgo Tomccat Server.VTS是一个应用服务器与OSGi紧密结合并且可以开发bundles形式的Spring web apps应用,他们同样拥有OSGi和S ...

随机推荐

  1. Python Quick Start

    1.安装Python 官网下载python: https://www.python.org/ 有2.x 3.x版本, 注意,python3.0不向下兼容2.x版本,有很多包3.0不提供 下载完后直接点 ...

  2. IOS TextField设置大全

    //初始化textfield并设置位置及大小  //设置边框样式,只有设置了才会显示边框样式     text.borderStyle = UITextBorderStyleRoundedRect; ...

  3. APC -- Asynchronous Procedure Call 异步过程调用

    异步过程调用(APC -- Asynchronous Procedure Call )是一种与常用的和简单的同步对象不同的一种同步机制. 我们在我们线程里使用基本的同步对象如MUTEX去通知其它线程, ...

  4. (转)JVM参数调优八大技巧

    这里和大家分享一下JVM参数调优的八条经验,JVM参数调优,这是很头痛的问题,设置的不好,JVM不断执行FullGC,导致整个系统变得很慢,网站停滞时间能达10秒以上,相信通过本文的学习你对JVM参数 ...

  5. (转)印度建全球最大生物识别数据库,MongoDB安全受质疑

    受棱镜门影响,各界对Aadhar的质疑从是否将威胁人民隐私与安全,转而聚焦在 Aadhar 搜集.储存以及处理资料的方法,以及美国新创公司 MongoDB 在计划中扮演的角色. 泱泱大国印度一直以来都 ...

  6. Java知识思维导图

    注:图片来源于网络,谢谢分享. 1 开发环境Java SDK 下载和安装2 环境变量的配置(path和classpath)3 编程基础 标识符命名规范4 Java数据类型5 运算符6 分支语句(if, ...

  7. 暑假集训(4)第一弹 -----递推(Hdu2039)

    题意梗概:fff团团员小A想退团了,不过要退团,他必须绘制出贤者法阵,以证明他有资格不受大fff之灵的监督 并退团,小A他现在要开始收集材料了,但是,他不清楚应该买多少份材料. 虽然你并不想帮他退团, ...

  8. Atl笔记二:BEGIN_COM_MAP

    1,offsetofclass获取基类相对于子类的偏移位置. #define _ATL_PACKING 8#define offsetofclass(base, derived) ((DWORD_PT ...

  9. 实现android支持多线程断点续传下载器功能

    多线程断点下载流程图: 多线程断点续传下载原理介绍: 在下载的时候多个线程并发可以占用服务器端更多资源,从而加快下载速度手机端下载数据时难免会出现无信号断线.电量不足等情况,所以需要断点续传功能根据下 ...

  10. alter和alert的一些问题

    今天在Java学习群里看到有人问:用alert能不能修改表结构?我第一反应是,alert是弹窗啊,怎么修改表结构?后来再看才知道,是那人打错了!我也晕了一下,还是记一下吧!alter是修改表结构的,a ...