Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8478699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:49:01+00:00 2026-06-10T18:49:01+00:00

I have a vpn connection and when I’m running python -m SimpleHTTPServer, it serves

  • 0

I have a vpn connection and when I’m running python -m SimpleHTTPServer, it serves on 0.0.0.0:8000, which means it can be accessed via localhost and via my real ip.
I don’t want robots to scan me and interested that the server will be accessed only via localhost.

Is it possible?

python -m SimpleHTTPServer 127.0.0.1:8000  # doesn't work.

Any other simple http server which can be executed instantly using the command line is also welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:49:02+00:00Added an answer on June 10, 2026 at 6:49 pm

    If you read the source you will see that only the port can be overridden on the command line. If you want to change the host it is served on, you will need to implement the test() method of the SimpleHTTPServer and BaseHTTPServer yourself. But that should be really easy.

    Here is how you can do it, pretty easily:

    import sys
    from SimpleHTTPServer import SimpleHTTPRequestHandler
    import BaseHTTPServer
    
    
    def test(HandlerClass=SimpleHTTPRequestHandler,
             ServerClass=BaseHTTPServer.HTTPServer):
    
        protocol = "HTTP/1.0"
        host = ''
        port = 8000
        if len(sys.argv) > 1:
            arg = sys.argv[1]
            if ':' in arg:
                host, port = arg.split(':')
                port = int(port)
            else:
                try:
                    port = int(sys.argv[1])
                except:
                    host = sys.argv[1]
    
        server_address = (host, port)
    
        HandlerClass.protocol_version = protocol
        httpd = ServerClass(server_address, HandlerClass)
    
        sa = httpd.socket.getsockname()
        print "Serving HTTP on", sa[0], "port", sa[1], "..."
        httpd.serve_forever()
    
    
    if __name__ == "__main__":
        test()
    

    And to use it:

    > python server.py 127.0.0.1     
    Serving HTTP on 127.0.0.1 port 8000 ...
    
    > python server.py 127.0.0.1:9000
    Serving HTTP on 127.0.0.1 port 9000 ...
    
    > python server.py 8080          
    Serving HTTP on 0.0.0.0 port 8080 ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have transactional replication running between two servers over a dedicated VPN connection. The
I am trying to start my VPN connection (using VPNC) from PHP. I have
I have a Windows Service that must connect, via VPN, to the network in
I have a VPN connection. In order to establish the VPN connection, there is
I need to connect to a webservice which is behind of a VPN via
Can anyone tell me how to make connection in webconfig file (which don't require
So at work i use a vpn connection and after that i have to
I have a VPN connection that I keep losing, that I need to connect
I have a small software which connects to a pptp VPN server. It adds
Is it possible to programmatically create VPN profile on Android (assuming that I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.