A
A
Alexander Fadeev2015-07-06 20:50:47
Nginx
Alexander Fadeev, 2015-07-06 20:50:47

Nginx returns 200 OK instead of static. What am I doing wrong?

Good afternoon.
There is one VPS. The main domain issi-global.com is attached to it. In the future, it is planned to bring all the statics to an additional server, but for now I just want to hang it on the static.issi-global.com subdomain. The
virtual server of the main domain is working fine and giving everything that it is supposed to do for now. But the host of statics instead of the statics itself gives just 200 OK and that's it.
Ubuntu 14.04, nginx
Here's an example trying to download files directly:

me$ wget http://static.issi-global.com/images/mailboxsort.png
--2015-07-07 01:06:24--  http://static.issi-global.com/images/mailboxsort.png
Resolving static.issi-global.com... 202.71.99.194
Connecting to static.issi-global.com|202.71.99.194|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [image/png]
Saving to: 'mailboxsort.png'

mailboxsort.png                    [ <=>                                                ]       0  --.-KB/s   in 0s     

2015-07-07 01:06:24 (0.00 B/s) - 'mailboxsort.png' saved [0/0]

me$ wget http://issi-global.com/index.html
--2015-07-07 01:07:46--  http://issi-global.com/index.html
Resolving issi-global.com... 185.87.49.241
Connecting to issi-global.com|185.87.49.241|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 427 [text/html]
Saving to: 'index.html'

index.html                     100%[===================================================>]     427  --.-KB/s   in 0s     

2015-07-07 01:07:47 (11.3 MB/s) - 'index.html' saved [427/427]

And no, everything is fine with the files:
root# ls -l
total 40
-rwxr-xr-x 1 issi issi 38502 Mar 11 19:49 mailboxsort.png

Moreover, both are saved, but the first one, downloaded from the statics, is empty, of course.
In browsers the same garbage.
70ca9fca1096496898be793f88748b93.png
What does it mean?
The logs are empty. The static.issi-global.com config seems to be standard, no different from the rest:
server {
        listen 80;

        server_name static.issi-global.com;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ {
                root /pathToDomen/static.issi-global.com/;

                access_log      /pathToDomen/static.issi-global.com/logs/nginx-access.log;
                error_log       /pathToDomen/static.issi-global.com/logs/nginx-error.log;


        }
}

Okay, if it gave an error. Okay, if I didn’t give statics at all. Okay, if there were some other glitches. But he says yes, everything is fine, he gives the file, but empty. What kind of nonsense? Or am I not understanding something?
Tell me, where did I mess up that I can’t see errors point-blank? =(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Alyakimov, 2015-07-06
@AlexFadeev

Is static.issi-global.com registered on the dns server?

S
Sergey, 2015-07-06
@Weidmann

error_log /pathToDomen/static.issi-global.com/logs/nginx-error.log debug;
And see what is written on the server when requested.
Possibly instead:
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ {
root /pathToDomen/static.issi-global.com/ ;
}
Required:
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ {
alias /pathToDomen/static.issi-global.com;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question