Question

Why The changes of my development server, are not reflected in the production server (views and urls)??

Posted May 18, 2017 13k views
NginxUbuntu

Hi, I am writing to see if you can help me with this: I happen is that I make changes in the development server and they work me well, but when I want to see them in production, I do not recognize them and I throw the error:

Page not found (404)
Request Method: GET
Request URL: http://www.maxsistemas.cl/casas/mipagina

I have tried all sorts of views, and called in urls, (all of them work in development, but nothing works for me in production) last clone a class definition that makes the same call and uses the same template but only change the name of the Definition to see if it works, and it happens to me the same everything works well in development, but when I want to see it in production, I throw the error mentioned at the beginning (404).

I have also tried, reloading nginx with several commands for me to take the changes, but the negative result even, these are the commands I tried:

Sudo systemctl daemon-reload
Sudo systemctl start gunicorn
Sudo systemctl restart nginx
Sudo systemctl start nginx
Sudo ufw allow ‘Nginx Full’

Thank you for the help, I do not know what else to try.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
14 answers

@maxgonpe

Checking the error logs would be the best thing to do if you’re not seeing the intended result.

tail -20 /var/log/nginx/error.log

That’ll at least detail what errors are resulting. From there, we can see if there’s anything that’ll help us to identify an issue.

@jtittle

The truth, I do not have the level to interpret this output of the command tail, but you manage to know what is happening? . I keep investigating for myself, but I’m still in a mystery

(myprojectenv) root@max:/home/max/myproject/myproject# tail -20 /var/log/nginx/error.log
2017/05/18 14:30:52 [notice] 10504#10504: signal process started
2017/05/18 17:19:53 [alert] 13633#13633: *42 open socket #10 left in connection 3
2017/05/18 17:19:53 [alert] 13633#13633: *43 open socket #11 left in connection 4
2017/05/18 17:19:53 [alert] 13633#13633: aborting
2017/05/18 17:20:41 [notice] 14117#14117: signal process started
2017/05/18 17:20:56 [alert] 14104#14104: *5 open socket #10 left in connection 3
2017/05/18 17:20:56 [alert] 14104#14104: *3 open socket #11 left in connection 4
2017/05/18 17:20:56 [alert] 14104#14104: aborting
2017/05/18 20:16:19 [alert] 14636#14636: *21 open socket #11 left in connection 7
2017/05/18 20:16:19 [alert] 14636#14636: aborting
(myprojectenv) root@max:/home/max/myproject/myproject#

  • @maxgonpe

    I’ve seen reports of socket leaks with NGINX from time to time, though without more info, they can be a bit hard to isolate and pinpoint.

    You can modify the error log so that it includes debugging information. To do this, you’ll need to open up /etc/nginx/nginx.conf:

    nano /etc/nginx/nginx.conf
    

    Then search for error_log. If it doesn’t exist, we can add the directive to the http block.

    error_log /var/log/nginx/error.log debug;
    

    You’ll then need to restart NGINX using:

    service nginx restart
    

    or

    systemctl restart nginx
    

    If that causes NGINX to fail, the version of NGINX you’re using may not be compiled with the --with-debug option, in which case the only other option to debug is to compile NGINX from source with that option.

    You can do a quick check from the CLI using:

    nginx -V 2>&1 | grep -- '--with-debug'
    

    or search for it manualling by running:

    nginx -V
    

    … and searching through the -- ... lines.

    If nothing is returned indicating thta debugging is enabled, a source compile would be required to further debug NGINX.

@jtittle

Also check the access.log and as I explain before I can enter all the other urls, but “libros” that if I can do it in my development environment, in production I can not access

root@max:/var/log/nginx# tail -5 /var/log/nginx/access.log
181.163.31.46 - - [18/May/2017:21:50:02 +0000] “GET /media/casas/imagenes/Foto-0001.jpg HTTP/1.1” 200 146318 “http://www.maxsistemas.cl/casas/lista_casas_arriendos/” “Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36”

181.163.31.46 - - [18/May/2017:21:50:03 +0000] “GET /media/casas/imagenes/Foto0029.jpg HTTP/1.1” 200 317257 “http://www.maxsistemas.cl/casas/lista_casas_arriendos/” “Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36”

181.163.31.46 - - [18/May/2017:21:50:04 +0000] “GET /media/casas/imagenes/Foto0171.jpg HTTP/1.1” 200 730246 “http://www.maxsistemas.cl/casas/lista_casas_arriendos/” “Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36”

(((******* this ********* )))
181.163.31.46 - - [18/May/2017:21:50:14 +0000] “GET /casas/libros HTTP/1.1” 404 1165 “-” “Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36”


181.163.31.46 - - [18/May/2017:21:50:22 +0000] “GET / HTTP/1.1” 200 1520 “-” “Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36”
root@max:/var/log/nginx#

@jtittle

First of all I am very grateful of you, since you help me. And that has a lot of value.

This turned out to be my friend, I hope it throws some data that can serve

root@max:/var/log/nginx# service nginx restart
root@max:/var/log/nginx# systemctl restart nginx
root@max:/var/log/nginx# nginx -V 2>&1 | grep – ’–with-debug’
configure arguments: –with-cc-opt=’-g -O2 -fdebug-prefix-map=/build/nginx-fTQkOt/nginx-1.10.1=. -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -DFORTIFYSOURCE=2’ –with-ld-opt=’-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now’ –prefix=/usr/share/nginx –conf-path=/etc/nginx/nginx.conf –http-log-path=/var/log/nginx/access.log –error-log-path=/var/log/nginx/error.log –lock-path=/var/lock/nginx.lock –pid-path=/run/nginx.pid –http-client-body-temp-path=/var/lib/nginx/body –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-proxy-temp-path=/var/lib/nginx/proxy –http-scgi-temp-path=/var/lib/nginx/scgi –http-uwsgi-temp-path=/var/lib/nginx/uwsgi –with-debug –with-pcre-jit –with-ipv6 –with-httpsslmodule –with-httpstubstatusmodule –with-httprealipmodule –with-httpauthrequestmodule –with-httpadditionmodule –with-httpdavmodule –with-httpgeoipmodule –with-httpgunzipmodule –with-httpgzipstaticmodule –with-httpimagefiltermodule –with-httpv2module –with-httpsubmodule –with-httpxsltmodule –with-stream –with-streamsslmodule –with-mail –with-mailsslmodule –with-threads
root@max:/var/log/nginx#

@jtittle


2017/05/18 23:04:40 [debug] 19267#19267: 21 writev: 1441 of 1441
2017/05/18 23:04:40 [debug] 19267#19267: *21 http write filter 0000000000000000
*
2017/05/18 23:04:40 [debug] 19267#19267: *21 http copy filter: 0 “/casas/mipagina?”**
2017/05/18 23:04:40 [debug] 19267#19267: *21 http finalize request: 0, “/casas/mipagina?” a:1, c:1
2017/05/18 23:04:40 [debug] 19267#19267: *21 set http keepalive handler

@maxgonpe

Nothing seems to really look out of ordinary to me, so the issue, based on what I’m seeing, would be somewhere in the production environment.

There’s something, somewhere, that differs between your development and productions servers. It’s, unfortunately, not something that you’ll find within NGINX because all NGINX is really doing is taking the request and proxying it over to your app.

What I’d recommend doing is retracing your steps and make sure that everything you setup for the development server is identical to what you’re running for production. When it comes to detailed setups and configurations, it’s easy to miss a step here or there and ultimately, that can lead to an application not working as expected or completely failing.

@jtittle

Hmmm, well.

I am intrigued that I do not have any separate development and production configurations, since what I run with python3 manage.py runserver 0.0.0.0.8000 and it works, I assume that when I exit the development environment and run the nginx start, it should work same. That is why I am worried about this, since it is taking away time and I can not get out of the trap.

In case of any idea in specific, please let me know and anyway, thank you very much for your inconvenience and for everything that always helps me.

thanks take care

@maxgonpe

What does your server block for NGINX look like?

@jtittle

Sorry that I did not answer you last night, but here in the end of South America it was late and I had to go to sleep. Today I greet you with a few “good morning” and I send you this one to strike down here; However, tell me if you can see any obvious flaws or suddenly recommend that I re-do the site completely again, but I’d like you to find out what it might be, because otherwise, it’s going to be a factor of uncertainty regarding python and django .

I will be waiting for your answer to see what to do, if you insist on discovering the fault or on the contrary redo everything again, although I prefer the first option.

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
workerconnections 768;
# multi
accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

typeshashmaxsize 2048;
# server
tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;

accesslog /var/log/nginx/access.log;
error
log /var/log/nginx/error.log;
error_log /var/log/nginx/error.log debug;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml appli$

    ##
    # Virtual Host Configs
   ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

}

mail {

# See sample authentication script at:

# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

# auth_http localhost/auth.php;

# pop3_capabilities “TOP” “USER”;

# imap_capabilities “IMAP4rev1” “UIDPLUS”;

server {

listen localhost:110;

protocol pop3;

proxy on;

   #               protocol   pop3;

proxy on;

server {

listen localhost:143;

protocol imap;

proxy on;

}

Previous 1 2 Next