엔진엑스에 브라우저 캐시 적용하려면 .htaccess 에 적는거처럼
서버파일에 추가한 conf 파일에 그냥 적어버리면 되는건가요?
아니면 https://www.conory.com/use_forum/52430 여기에 있는 이것만 적고 끝내도 되는건가요?
엔진엑스에 브라우저 캐시 적용하려면 .htaccess 에 적는거처럼
서버파일에 추가한 conf 파일에 그냥 적어버리면 되는건가요?
아니면 https://www.conory.com/use_forum/52430 여기에 있는 이것만 적고 끝내도 되는건가요?
댓글 3
XE rewrite 규칙은 짧은주소를 사용하기 위해 필요한 최소한의 규칙일 뿐이고요...
브라우저 캐싱은 직접 추가하셔야 합니다.
보통 아래와 비슷한 방식을으로 확장자를 지정한 후 expires 명령을 쓰지요.
location ~* \.(jpe?g|png|gif|bmp|ico|svg|flv|mp[34]|woff|ttf|css|js)$ {
expires 30d; # 30일
}
블로그에만 메모해버렸구나!
그래도 답변 감사합니다! ㅎㅎ
/etc/nginx/sites-enabled
이쪽으로 이동해서 서버 설정 파일오픈
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M; #한달
access_log off;
add_header Cache-Control "public";
}
location ~* \.(?:css|js)$ {
expires 1y; #일년
access_log off;
add_header Cache-Control "public";
}
이걸 자기 서버단쪽에 추가
예시
server {
server_name 서버도메인;
root /home/서버폴더/public_html;
include xe.conf;
index index.html index.htm index.php;
location ~ \.php$ {
limit_req zone=limit burst=5 nodelay;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/서버폴더/public_html$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
}