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

May 18, 2017 122 views
Nginx Ubuntu

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.

14 Answers


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.


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


    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.


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 - - [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" - - [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" - - [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 ********* ))) - - [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" - - [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"


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


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


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.


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 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


What does your server block for NGINX look like?


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;
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; } - - [19/May/2017:12:47:19 +0000] "GET /casas/listacasasventas/ HTTP/1.1" 200 2068 "http://www.maxsistemas.cl/casas/publicar/" "Mozilla/5.0 (X11; Linux.......... - - [19/May/2017:12:47:21 +0000] "GET /casas/listacasasarriendos/ HTTP/1.1" 2$ - - [19/May/2017:12:47:24 +0000] "GET /send/ HTTP/1.1" 200 2619 "http://www.max$ - - [19/May/2017:12:47:24 +0000] "GET /media/photo/logo.png HTTP/1.1" 200 10317$ - - [19/May/2017:12:47:24 +0000] "GET /media/photo/max8-ot88.png HTTP/1.1" 200 $ - - [19/May/2017:12:47:26 +0000] "GET /admin/ HTTP/1.1" 200 1196 "http://www.ma$ - - [19/May/2017:12:47:29 +0000] "GET / HTTP/1.1" 200 1520 "http://www.maxsiste$ - - [19/May/2017:12:47:31 +0000] "GET / HTTP/1.1" 200 1520 "http://www.maxsiste$ - - [19/May/2017:12:53:45 +0000] "GET /casas/mipagina HTTP/1.1" 404 1164 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 .............

Comparing a good request with one that does not respond and that is the case of my problem, I see that the first one returns a string

  "GET / houses / rentallist / HTTP / 1.1" http://www.maxsistemas.cl/casas/listacasas_ventas/ "

But in which I call the page that I can not see, it returns the empty string
"GET / houses / mipagina HTTP / 1.1" 404 1164 "-"

Does this give you any clue?


Please, this is below I send it to support, but they did not give me any specific answer but I am responsible for what I do on my server,

Now please read it and tell me if this throws you some previous experience or I forget the subject ??

this to support ----->

After doing a thousand things with my code and try it and re-test it on my local machine and on the development server in my droplet, I make changes to my code and I incorporate new pages, and everything works well for me on both sides My home and the environment of development of the droplet).

But when I want to see the changes in my domain, these are not reflected and after making queries in the community and investigate by other means the conclusion is that "there are no programming errors, or configuration"

So I did a last test and delete several urls from my urls.py file and after that I completely deleted my urls.py file and of course I can not enter my application because it gives me error, but in the domain everything follows such As if nothing has happened, then I stopped the server with all the commands to stop and restore and my site keeps pointing everything as it is without changes (like glue stick) no matter what I do, it does not reflect my urls changes.

These are the commands I tried to take off my nginx:

Sudo systemctl start nginx
Sudo systemctl stop nginx
Sudo systemctl restart nginx
Sudo service nginx start
Sudo service nginx stop
Sudo service nginx restart
Sudo /etc/init.d/nginx start
Sudo /etc/init.d/nginx stop
Sudo /etc/init.d/nginx restart

Can you check what happens in my droplet ??? Or give me some command to reset nginx and take what I do in development ??

@jtittle Finally succeed in solving !!!

Was what I suspected, finally managed to find the right command that generated a borron and new account in my drop and so take into account the changes made. The solution in case you ever come across a similar problem is:

"Sudo reboot"

Thank God, and I can go ahead with my project.


Have another answer? Share your knowledge.