LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   unable to connect to nginx server from other machine (http://www.linuxquestions.org/questions/linux-newbie-8/unable-to-connect-to-nginx-server-from-other-machine-894457/)

dhairya 07-29-2011 05:38 AM

unable to connect to nginx server from other machine
 
on my machine I have installed nginx server. I am able to access it using http://localhost

But when I try to connect it from other machine using my machine's IP(172.16.10.211) address and port number(80), it fails. It just doesn't connect.
n both the machines, I have made firewalls OFF.
Host machine having linux has selinux disabled and other machine having window's OS has all firewalls OFF.
--------------------------------------------------------------------
[root@localhost ~]# uname -r
2.6.18-238.19.1.el5
---------------------------------------------------------------------

Please help me know the solution to access nginx server from other machine on same LAN.

bathory 07-29-2011 08:00 AM

Hi,

What gives:
Code:

netstat -tanpl|grep nginx

dhairya 07-29-2011 08:19 AM

thanks bathory for quick reply.
here is the output:

[root@localhost ~]# netstat -tanpl|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3660/nginx.conf
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3660/nginx.conf

bathory 07-29-2011 09:00 AM

Quote:

[root@localhost ~]# netstat -tanpl|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3660/nginx.conf
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3660/nginx.conf
So nginx is running and listens on all available interfaces and it should answer to connections from other hosts since there is no firewall in between.
What is the exact error you get? Is there anything written in the logs? Can you ping the host running nginx?

dhairya 07-29-2011 11:04 AM

Ping -t 172.16.10.211 is able to connect

Browser is unable to connect http://172.16.10.211:80/

where should i search error log?

bathory 07-29-2011 11:32 AM

Can you connect from the same server running nginx using http://172.16.10.211
If you're running RHEL (or derivatives) and you've installed nginx using yum, the logs should be located under /var/log/nginx. Or you can find their location in nginx.conf (search for the error_log directive)
BTW check if it's SELinux that prevents connecting from remote hosts to your web server.

dhairya 07-31-2011 11:37 PM

"Can you connect from the same server running nginx using http://172.16.10.211"

YES. I can open the home page using http://172.16.10.211 from the machine where nginx is installed
-------------------------------------------------------------------------------------------------------------
"If you're running RHEL (or derivatives) and you've installed nginx using yum, the logs should be located under /var/log/nginx. Or you can find their location in nginx.conf (search for the error_log directive)"


Both the files (access.log and error.log) at /var/log/nginx/ are empty.
[root@localhost ~]# ls /var/log/nginx/
access.log access.log.1.gz error.log error.log.1.gz

-------------------------------------------------------------------------------------------------------------
"BTW check if it's SELinux that prevents connecting from remote hosts to your web server."

please see the output
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0

dhairya 07-31-2011 11:50 PM

I initially just switched of the selinux from
/var/log/nginx/ and making it
SELINUX=disabled

but now I used lokkit command and disabled the security and I could connect.

Thanks a lot.


All times are GMT -5. The time now is 04:46 PM.