Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Hosting my own Webpage

Tags:
  1. Jan 26, 2017 #1

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Hi all,
    How can I use my own PC as a server so that I can host my own webpage? Do I need some special software for this?
     
  2. jcsd
  3. Jan 26, 2017 #2

    fresh_42

    Staff: Mentor

  4. Jan 26, 2017 #3

    Borg

    User Avatar
    Gold Member

    You will probably need to open a port on your router also. Be warned that the hackers will come as soon as you do.
     
  5. Jan 26, 2017 #4

    QuantumQuest

    User Avatar
    Gold Member

    In addition to the above, if you want something close to a real web server (not just experimenting), your machine must have the resources to handle multiple requests at every instant, so a good reliable power supply, HD technology/available space, RAM and CPU technology/speed really matter. Be also prepared for some extra cooling as you must have continuous operation of the machine and good uptime stats. One other thing, related to what Borg said, is security measures you have to take.
     
  6. Jan 26, 2017 #5

    jedishrfu

    Staff: Mentor

    An alternative to Apache is node.js which is much lighter weight but extremely durable. You might need to learn a little javascript code to make it do what you want.

    There are many tutorials online to show how to do this and here's one example:

    https://blog.xervo.io/build-your-first-http-server-in-nodejs

    and this one creating a simple static page web server:

    https://gist.github.com/ryanflorence/701407

    where if the web page exists it will return it.

    Or more simply here are other means of creating a static server:

    https://gist.github.com/willurd/5720255

    One caveat is that these one-liner solutions may open your machine to hacking so be aware.

    The python solution may already be on your machine if you have MacOS:

    python -m SimpleHTTPServer 8000
     
    Last edited: Jan 26, 2017
  7. Jan 27, 2017 #6

    Borg

    User Avatar
    Gold Member

    If you're just starting out and don't have a lot of experience with security issues, you can use security through obscurity. I've been running a server on a Raspberry Pi 2 for over a year and I track intrusion attempts. One thing that I have clearly seen is that the script kiddies and corporations like Shodan go after specific common ports like 80, 8080, 443 and 8443. If you use an oddball port like 11111, the intrusions drop to nothing.
     
  8. Jan 27, 2017 #7

    jedishrfu

    Staff: Mentor

    Attention KMART shoppers may I direct your attention to port # 11111!

    There are quite a few other ports that they could check for too:

    https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

    and 11111 is on it.
     
  9. Jan 27, 2017 #8

    Borg

    User Avatar
    Gold Member

  10. Jan 27, 2017 #9

    jedishrfu

    Staff: Mentor

    I think you're right though , it unlikely that they would find it but as their database of connected devices increases and as people start to do the same trick they might extend their scan. Also if they somehow find a more common port open but can't find anything interesting, they might poke around looking at other ports.

    So the best approach is to not have the server operational 24/7 but only when needed and to turn if off or terminate the server app when not in use.
     
  11. Jan 27, 2017 #10

    Borg

    User Avatar
    Gold Member

    From what I can tell, they just walk through the ip addresses sequentially and hit the same port every time. If they have to then check dozens (or thousands) of ports, that doesn't allow them to search much of the web. I left my server running on an odd port for a month last year and didn't get a single intrusion attempt.

    BTW, Shodan is my biggest annoyance. They have dozens of servers spread out between Europe, Chicago and San Diego. If you block one IP, the others try just to make sure they can still find you. Even the Chinese and the Russians aren't that persistent.
     
  12. Jan 27, 2017 #11

    jedishrfu

    Staff: Mentor

  13. Jan 27, 2017 #12

    Borg

    User Avatar
    Gold Member

  14. Jan 27, 2017 #13
    Most ISPs will forbid this activity by blocking port 80 and not assigning you a static IP. You can run a web server on your computer but it won't be accessible to the outside.
     
  15. Jan 27, 2017 #14

    jtbell

    User Avatar

    Staff: Mentor

    If you're using a home computer and you're in the US, check your ISP's terms of service. They very likely forbid publicly accessible servers on residential (not business) service plans.
     
  16. Jan 27, 2017 #15

    QuantumQuest

    User Avatar
    Gold Member

    From what I've read at times in papers/stats - internet security is one of the fields that keeps me interested for a long time, it really depends on whom you have to do with. Some script kiddies or amateur hackers they do this for fun and yes they usually work their way sequentially, hitting the same port(s). But there are guys that launch some sophisticated port scanners that they can go even to the point, that this is almost invisible. Of course, this is no warning for the OP, as these intrusion attempts are aimed to steal/modify very valuable resources. It is very unlikely that this gonna happen to some small server out there, at random - but who knows?:)).
     
  17. Jan 27, 2017 #16

    QuantumQuest

    User Avatar
    Gold Member

    And this is also a very fair point not previously mentioned. This is something to be discussed and dealt with your ISP.
     
  18. Jan 29, 2017 #17

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Thanks all, I am kind of curious; don't know if this is dumb: despite not having Apache or any other server software installed, I seem to somehow be using my PC as a server when using the Anaconda package (Jupyter Notebook as the interface), I am using it as a local host in port 8888. What gives? EDIT: Am I not running a client-server application in which I am using my own PC (meaning PC software) in the role of the server?
     
    Last edited: Jan 29, 2017
  19. Jan 29, 2017 #18

    Nidum

    User Avatar
    Science Advisor
    Gold Member

    It may be safer and easier to use a website hosting service . The BT service that I use professionally provides excellent set up help and has draconian hacker defences .
     
  20. Jan 29, 2017 #19

    QuantumQuest

    User Avatar
    Gold Member

    The Jupyter Notebook App you use, is a server-client application in which through your web browser, you can edit or run notebook documents. Now, this app can be executed on your local machine, having no internet access or alternatively be installed on a remote machine and accessed through internet. In any case, there is some server software listening to some port (e.g. 8888) and also some client software communicating with it, for the purposes of the Jupyter app. The code contained in a Notebook document is executed by a kernel, that is launched automatically when you open a such document. In your case this is the ipython kernel for the python language.
     
  21. Jan 30, 2017 #20

    jtbell

    User Avatar

    Staff: Mentor

    You can do the same thing if you run Apache on your own PC. It will serve web pages from your disk to your web browser via port 80 (by default). I use this for testing changes to my web site before uploading them to my web-hosting service. I keep a complete copy of my web site on my Mac for this purpose. It also serves as a backup to the online copy. The pages are under my user account, so I access them with URLs starting with http://localhost/~jtbell/ . I can also access them from other devices on my local network, using the IP address shown in my Mac's System Preferences: http://192.168.0.2/~jtbell/ . I just tried it on my iPhone, using my local WiFi network. But nobody outside my local network can get to them, I think. At least I can't see any evidence of it in my Apache log files.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Hosting my own Webpage
  1. Designing a webpage (Replies: 17)

  2. Making a webpage (Replies: 8)

  3. Apache Virtual Host (Replies: 2)

Loading...