I have my web application built in python. I wish to have ssl certificate installed. How would I know which web server is running on my server? nginx or apache? Currently if i stop apache or nginx, the server does not shut down. I am able to see the running application even when the web server is down.
Use netstat in this case.
This will allow you to see what exactly is listening on the TCP port.
If you happen to be using Windows:
netstat -a -n -b
Linux:
sudo netstat -ltnp
Related
I'm new to Docker. I get a connecting error when trying to setup Docker in PyCharm Professional edition.
I have followed this official manual and turn on the checkbox(Expose daemon on tcp://localhost:2375 without TLS)
But it still not work.
Cannot connect: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.O.O.1:2375
caused by: java.net.ConnectException: Connection refused: no further information
I have accidentally connected docker one time.But when i restart my computer i cannot connect docker anymore.
Any further help would be gratefully appreciated.
If you are facing connection refused then there may be a chance that there is no server to respond to your request.
So first check whether docker server is listening on 2375 port.
netstat -anp tcp | findstr 2375
Or, use tcpview for GUI.
If docker is not listening on this port, then check your C:\ProgramData\Docker\config\daemon.json file and verify whether you have the below Key value pair in your JSON.
"hosts": ["tcp://0.0.0.0:2375"]
If it is not there, then add this and restart your docker daemon.
If you are behind a proxy, then make sure to add this in no-proxy, so that your requests will not be routed via a proxy server.
NOTE: I don't have any experience with docker on windows
I have two computers in the same enterprise network. The one with Windows XP (IP 192.168.101.96) and the other with Windows 7 (IP 192.168.101.98).
If I start Django project on PC with Windows XP (python manage.py runserver 192.168.101.96:8001), I can easily access it from Windows 7 PC with browser.
But the opposite way doesn't work. If I start Django project on PC with Windows 7, I can't access it from Windows XP PC.
The same situation is with command python -m SimpleHTTPServer 8001.
I tried to add a rule for external connections on TCP port 8001 in Windows firewall settings. Also I tried to add python.exe to firewall exceptions, but nothing seems to work...
It should be noted that when I start Django server and execute NETSTAT -p tcp -ano command, I can see line:
TCP 192.168.101.98:8001 0.0.0.0:0 LISTENING 6920
But nevertheless, nothing work. What can be the source of the problem?
for access to another computer server , server must be run on port 80.
you must run django server on port 80
python manage.py runserver 0.0.0.0:80
then access with type ip in the browser without post number :
http://192.168.101.98/
good luck
The problem was in ESET Endpoint Security special firewall. It's "automatic mode" blocks traffic without any promt to user. The problem can be solved by adding special rule to this firewall or changing it's main policy to "interactive mode" for example.
I was setting up a public Ipython Notebook in my remote Ubuntu 12.04 server according to http://ipython.org/ipython-doc/1/interactive/public_server.html#notebook-public-server, but when all was done, I cannot connect to it via both chrome and safari (in both https and http modes), I got timeout error in chrome, safari told me server isn't responding. So I tested the system by setting up following simple python server:
python -m SimpleHTTPServer
And the same error occured. I also checked the port with sudo netstat -anltp|grep :8000, which seems fine:
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 22683/python
What surprises me is that I have the apache running and holding websites just fine (I also try to turn it off when configuring python server but that didn't help). Can anyone give me a clue what might be wrong in the Ubuntu server and how I should debug it?
I have found the issue: it turns out that the ports are closed by firewall, although in netstat it says python is listening to port 8000, but when incoming request reaches port 8000 it is rejected before getting to python server. By opening the ports the issue can be well resolved.
It turns out that the ports are closed by firewall, although in netstat it says python is listening to port 8000, but when incoming request reaches port 8000 it is rejected before getting to python server. By opening the ports the issue can be well resolved.
We have developed an app in python and are using flask to expose its api via http requests.
all this on WINDOWS -
Everything works ok and we have tested in-house with no problems and we are now trying to use the app in the real world - we have gotten our IT dept to give us a public facing ip/port address (forwarded through a firewall ??) and now we can't access the server/app at all.
After a bit of digging, we've found the problem has something to do with the Windows Firewall configuration, when its on it won't work, when its off everything is fine.
the flask app code is run like so: app.run(debug=False, host='0.0.0.0', port=8080)
the port 8080 is setup in the Firewall Exceptions as is python.exe in the Program Exceptions
netstat -a shows the app is sitting there awaiting connection.
If I try to access the site though chrome I get the error: ERR_CONNECTION_TIMED_OUT.
With the firewall on i'm never seeing any "hits" come through to the app at all.
Is there some other configuration I'm missing?
Many thanks.
When running Flask from a windows machine with a firewall I open a port with the following commands:
netsh firewall add portopening TCP 8080 "MyAppName"
netsh advfirewall firewall add rule name="MyAppName TCP Port 8080" dir=in action=allow protocol=TCP localport=8080
netsh advfirewall firewall add rule name="MyAppName TCP Port 8080" dir=out action=allow protocol=TCP localport=8080
It work for me. Is it too much? I don't know as I am not a Firewall guru :(
When running as a service the program running the service is not python.exe but rather pythonservice.exe. You will have to add that to the allowed programs in the Windows Firewall Setup. In my case it is located under C:\Python33\Lib\site-packages\win32\pythonservice.exe.
I want to start a web2py server so that it can be accessed externally to the hosting server.
I've read this http://web2py.com/books/default/chapter/29/03
By default, web2py runs its web server on 127.0.0.1:8000 (port 8000 on
localhost), but you can run it on any available IP address and port.
You can query the IP address of your network interface by opening a
command line and typing ipconfig on Windows or ifconfig on OS X and
Linux. From now on we assume web2py is running on localhost
(127.0.0.1:8000). Use 0.0.0.0:80 to run web2py publicly on any of your
network interfaces.
but I can't find how to "Use 0.0.0.0:80" ? There doesn't seem to be a command line argument which would do that.
Thanks
EDIT: I should say the server in question does not have a GUI - I'm aware there's some sort GUI based admin facilties for web2py but that's out of the question here.
EDIT2: Just in case this is not clear (and on the offchance it makes any difference - which I doubt) I'm running the server like this :
sudo python web2py.py
not via wsgi/apache or the like.
python web2py.py --ip 0.0.0.0
just works fine but the log message will point you to an invalid address:
please visit:
http://0.0.0.0:8000
alternatively you can use ethernet interface ip but it will not listen also on localhost
What may help you is the fact that you can select the public ip when the server gui pops up asking for the admin password.
do the following in a terminal
install ufw with apt
add 8000 to firwall.
ufw allow 8000/tcp
ufw allow 8000/tcp
navigate to where your downloaded web2py is and cd web2py
use nano serverstartup.sh and add the line bellow
python2.7 web2py.py -a 'Server admin passwrod' -c server.crt -k server.key -i your device IP address -p 8000
change the the server admin password to any password of your choice.
chmod +x serverstartup.sh
run ./serverstartup.sh in your terminal
that is it. you can stop the server by holding control and c key on your keboard.