Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug connection from computer to server, server-side

My Centos 7 server is running apache 2.4.6, and is serving up a django webapp using mod_wsgi. My problem is that I cannot access the server url from my browser from another computer. I am not getting any errors from apache and its up and running no problem. I've set the error logs to 'debug' in the http.conf file but still no errors. I know the server is in fact connected to the internet by pinging it, i know it is listening on port :80 by running

netstat -tunlp | grep 80.

tcp        0      0 0.0.0.0:60080           0.0.0.0:*               LISTEN      3841/name-gu 
tcp6       0      0 :::80                   :::*                    LISTEN      13882/httpd  

I have temporarily turned off all firewalls server-side as well

My settings.py has the url, ip address, and localhost under ALLOWED_HOSTS

How do i debug this issue so i have an error i can look into?


Log: Let me know if more information is need ran tcpdump -nn tcp port 80 on server computer then ran curl -v myurl.com on my machine and get these results on my server:

13:11:52.225076 IP 10.0.24.67.40658 > 10.0.26.20.80: Flags [S], seq 3327782620, win 29200, options [mss 1460,sackOK,TS val 36451589 ecr 0,nop,wscale 7], length 0
13:11:52.225355 IP 10.0.26.20.80 > 10.0.24.67.40658: Flags [S.], seq 1689726058, ack 3327782621, win 28960, options [mss 1460,sackOK,TS val 73904848 ecr 36451589,nop,wscale 7], length 0
13:11:52.225960 IP 10.0.24.67.40658 > 10.0.26.20.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 36451590 ecr 73904848], length 0
13:11:52.226198 IP 10.0.24.67.40658 > 10.0.26.20.80: Flags [P.], seq 1:101, ack 1, win 229, options [nop,nop,TS val 36451590 ecr 73904848], length 100: HTTP: GET / HTTP/1.1
13:11:52.226448 IP 10.0.26.20.80 > 10.0.24.67.40658: Flags [.], ack 101, win 227, options [nop,nop,TS val 73904849 ecr 36451590], length 0
13:11:52.231414 IP 10.0.26.20.80 > 10.0.24.67.40658: Flags [P.], seq 1:286, ack 101, win 227, options [nop,nop,TS val 73904854 ecr 36451590], length 285: HTTP: HTTP/1.1 200 OK
13:11:52.232052 IP 10.0.24.67.40658 > 10.0.26.20.80: Flags [.], ack 286, win 237, options [nop,nop,TS val 36451596 ecr 73904854], length 0
13:11:52.232814 IP 10.0.24.67.40658 > 10.0.26.20.80: Flags [F.], seq 101, ack 286, win 237, options [nop,nop,TS val 36451597 ecr 73904854], length 0
13:11:52.233003 IP 10.0.26.20.80 > 10.0.24.67.40658: Flags [F.], seq 286, ack 102, win 227, options [nop,nop,TS val 73904856 ecr 36451597], length 0
13:11:52.233414 IP 10.0.24.67.40658 > 10.0.26.20.80: Flags [.], ack 287, win 237, options [nop,nop,TS val 36451597 ecr 73904856], length 0
like image 575
Mfreeman Avatar asked Mar 15 '19 17:03

Mfreeman


People also ask

How to debug server side code using command line?

This debugger runs only on IE browsers. And server side code can only be debugged by sitting on the server machine. we need to do is simple. At the place where a breakpoint needs to be set , type in the command debugger; for JavaScript. If stop Then start off the page/site. As the page environments.

How to debug ASP in ASP server side?

On selecting Properties, the properties dialog box opens up. In the Directories tab, on clicking on ASP debugging. This needs to be clicked ( a check box ) to enable server-side debugging. start up the site. The script debugger will be opened up at the

Why can’t I debug SSH connections?

The second common issue when debugging SSH connections is the use of a non-standard port. If SSH is running on another port other than the default port 22, you will not connect to the remote host unless you explicitly specify the port on which SSH is running. To view the port on which SSH is running, use a tool such as netstat as below:

How do I connect to my game server via RDP/SSH?

In order to connect to the VM hosting your game server (either Windows or Linux), you can get Remote Desktop (RDP)/SSH credentials using the "Connect" button on playfab.com web application. You can see this button on the "Virtual Machines" page on your Multiplayer Build) or using CreateRemoteUser API call.


1 Answers

First I would focus on verify that you can access some static test page on your Apache server, because it is listening only on an IPv6 port. (It is the most suspicious detail presented on your server. Maybe you configured only a DNS for an IPv4 address or you did not also ping6 on the IPv6 address. If it is a public server then it should probably listen finally on IPv4 also. It's clear that no service is listening on IPv4 tcp port 80, neither a proxy.) If it was not the problem then I will describe a strategy "debugging":

... Great, you checked some useful particular facts, but the most effective strategy is to try to bisect a big area of possible problems to "half" sized areas that can be checked independently whether they work or don't work and how it would manifest itself specifically if anything in that area is broken.

I would look in access log /var/log/httpd/access_log (default Apache log on CentOS) that a request has been received by Apache and what was the status code and that the size of response was zero or nonzero and that everything is ok between Apache and a browser. It is more useful to easily test the server first by one request from the same server, before you start to suspect a firewall etc., e.g. test it by a command line utility wget -S -O - http://mysite.example.com or curl -i http://mysite.example.com. If you check anything by a browser you should use developer tools Inspect (Ctrl+Shift+I), Network tab and see if the problem is related only to a response or still to sending the request.

I would eventually also verify that the logging from Python/Django works and that you are looking into the right Python log, e.g. by adding a log.info("something") command at the end of models.py, not only that you don't see any error.

The text "I cannot access the server url from my browser" requires more information what is exactly meant by it. Literally it would mean that the problem would not be related to Django/Python, but between Apache and browser, if it really can not start to connect and send headers of a request. A missing response requires to consider primarily Django/Python. Even an unconfigured Apache shows a test page and can be accessed by ip address, without a valid DNS: http;//numeric.ip.address. You may verify that you can configure temporarily a simple test static site on the same domain...

EDIT The debugging continued by responses and suggestion in comments and by added formatted log in the question. The logical process is more important than only a resume.

like image 149
hynekcer Avatar answered Oct 07 '22 23:10

hynekcer