Domanda

I'm using CentOS 6.5 with hostname NAFD only together with ip an address 192.9.200.69. I successfully installed Django-NginX-Gunicorn with Supervisor using this tutorial.

The django run successfully in 127.0.0.1:8000 without errors. I have no problem accessing the webserver django admin within the root user or other user within CentOS. With the assumption that django webserver should be accessable within the network, I can move on now to the next stage testing the application from client computer.

Here's the problem start.

When I try using http://nafd:8000/admin to connect from client computer within the network it gave me page not found. But when I used http://192.9.200.69/admin I get Nginx Welcome Powered Page.

I already set the CentOS firewall to accept port from 80 and 8000. I can ping the webserver using its ip address.

This is the first time I used Nginx-Gunicorn with Supervisor. I'm been using Django only in Win7 without giving me a problem accessing the webserver from client side.

From reading other related problems and possible solutions my direction now is installing DNS Server in my CentOS 6.5.

I need help if this is the right track to do? Or is there other possible way to solve this.

Thank you for your time reading.

Trace Route Result:

C:\Windows\System32>tracert -4 192.9.200.69

Tracing route to 192.9.200.69 over a maximum of 30 hops

1     1 ms    <1 ms    <1 ms  192.9.200.69

Trace complete.

NGINX Config

server {
  server_name nafd;
  access_log off;

  location /static/ {
       alias /opt/nafd/nafd_proj/nafd_proj/static;

  }

  location / {
       proxy_pass http://127.0.0.1:80;
       proxy_set_header X-Forward-Host $server_name;
       proxy_set_header X-Real-IP $remote_addr;
       add_header P3P 'CP="ALL DSP COR PSAa OUR NOR ONL UNI COM NAV"';
  }

}

Gunicorn Config

command = '/opt/nafd/bin/gunicorn'
pythonpath = '/opt/nafd/nafd_proj'
bind = '127.0.0.1:80'
workers = 3
#user = 'nafdit'

Update

When I run django in python manage.py runserver 0.0.0.0:8001, I can access the application from any computer within the network using 192.9.200.69:8001/admin in url but nafd:8001/admin don't work remotely.

È stato utile?

Soluzione 2

Looks like a DNS problem, your remote computer cannot resolve nafd to 192.9.200.69. You can check this by running nslookup 192.9.200.69, you probably will not get nafd. As a quick check you can change the remote computer's hosts file and add 192.9.200.69 nafd at the end, this will hardcode the host name to that IP address. Then restart your browser and try accessing nafd:8001/admin.

This will only make it work in that particular computer, for it to work across all computers in your network you'll need to set up a DNS server for your network (try these tutorials)

Hope that helps.

Altri suggerimenti

From the sounds of it here are 3 possible solutions.

DNS or Domain Name Service (or some call it domain name server). The DNS system usually just translates domain name / host names to ip addresses, and depending on your network set up, this may be a bit overkill. Mostly if you don't have a dedicated DNS server and are using an ISR or something of the like where you can't manually add a DNS, this would require quite a bit of network reconfiguration.

Netbios/WINS name. Windows by default will attempt communication using WINS/netbios names, however WINS being "Windows Internet Name Service" is not a feature that usually comes with most linux distros. To get this set up, you will need to install Samba and get it set up and opening the needed ports. http://wiki.centos.org/HowTos/SetUpSamba may help you out with this.

Hosts file configuration. It is also possible to get the functionality that you want by manually editing the hosts file of each computer. This would be like putting a manual DNS entry in each computer, and would also require that you make this configuration change for each computer you ever wish to add to the network (if you want to be able to browse by the PC name). in windows 7 the hosts file is located at C:\Windows\System32\drivers\etc\hosts and you would add the line "192.9.200.69 NAFD" to the bottom of the file. You should be able to use notepad, but you may wnat to note, notepad would have to be opened with Admin rights as it is a system file.

Of these 3 options, the one that sounds most like what you want with the least effort, would be setting up the samba service (Netbios/WINS) on the CentOS box.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top