Answer the question
In order to leave comments, you need to log in
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]
root# ls -l
total 40
-rwxr-xr-x 1 issi issi 38502 Mar 11 19:49 mailboxsort.png
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;
}
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question