Please show the sections of the file mentioned.
[/etc/nginx/conf.d/default.conf
near line 9 and 44]
Line 9: server rasa:5005;
Line 43-45: location ~* \.(?:ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)$
expires 365d;
add_header Cache-Control "public, no-transform";
}
But I’ve told you that this error occured when I added “?:” you suggested, it worked otherwise…
It happened when you ate the "{"
The location line should end with " {"
Can you show 5-15 instead of just line 9?
I’ve sent the whole file earlier, here you go the part you want:
upstream rasa {
#server 184.72.-187.19:5005;
#I had to this for port 5005 but not for landing because there default port is 80
server rasa:5005;
}
Do you think I have this entire thread memorized?
Do you think this is the only thing going on in my life?
I am trying to help you - for free.
Let’s play well together and be done with this quickly
I understand, no problem, thank you for helping I’m just saying so you can check more if you want.
I can't find the problem with that section.
fix the location line and rerun
nginx -t
Change this:
To this:
location ~* \.(?:ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)$ {
then run this again:
nginx -t
No errors now, but still don’t have the expiration time here too…
I’ve let the page run now if you want to check more
It shows the correct type (image/png) and yet won’t include the expire …
This is what I have working:
location ~* \.(?:ico|css|js|gif|jpeg|jpg|png)$ {
expires 9d;
add_header Pragma public;
add_header Cache-Control "public";
}#location
It shows:
curl -Iki https://beer4.work/images/2020.0131.jpg
HTTP/2 200
date: Tue, 24 Mar 2020 03:59:31 GMT
content-type: image/jpeg
content-length: 130646
last-modified: Mon, 10 Feb 2020 21:20:52 GMT
etag: "5e41c934-1fe56"
server: Flimsy-Expidited
expires: Thu, 02 Apr 2020 03:59:31 GMT
cache-control: max-age=777600
pragma: public
cache-control: public
accept-ranges: bytes
Yes, I don’t have this “expires:” part, do you have any idea what can I try next?
I’ve tried @rg305 exactly what you posted and I get this:
I also show this in the nginx.conf
file:
#Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}#map expires
Here is my nginx.conf, where should I add your code?
I’ve tried adding it at the end of my file but then my landing didn’t work at all.
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
Since my nginx conf loades deafult.conf I’ve added it here but it still doesn’t work, landing loads but there is no expiration time…
#location ^~ / {
location ^~ / {
proxy_pass http://landing;
include partials/common_location.conf;
include partials/cors.conf;
#include partials/common.conf;
#include partials/ssl.conf;
}
# location / {
# proxy_pass http://api/webhooks/rest/webhook;
# include partials/common_location.conf;
# include partials/cors.conf;
# }
location = /hotel { rewrite ^ /hotel/ redirect; }
location /hotel {
#proxy_pass http://rasa;
rewrite /hotel/(.*) /$1 break;
proxy_pass http://rasa/webhooks/rest/webhook;
#include partials/common.conf;
#include partials/ssl.conf;
#proxy_set_header Accept '*/token';
}
location ^~ /server {
proxy_pass http://server/sendMail;
#include partials/common.conf;
#include partials/ssl.conf;
}
}
#Expires map -added because of location ~* \.(?:ico|cs
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}#map expires
try adding the map section above the http section.
Doesn’t work then at all.
Sorry.
Place it at the end of the HTTP section,
Something like this:
include /etc/nginx/conf.d/*.conf;
#Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}#map expires
}#http
There must be something in your configuration that is preventing expires
Please post the entire config output with:
nginx -T