Created
March 31, 2022 04:16
-
-
Save pujianto/0b34819c8c21d0f2d6fbfc5a338eb36b to your computer and use it in GitHub Desktop.
WHM Serve static files directly from Nginx and fallback to apache if file no found. (WHM with Nginx Proxy Installed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place this file inside /etc/nginx/conf.d/server-includes/ | |
location @httpd_fallback { | |
proxy_pass $scheme://$CPANEL_APACHE_PROXY_REQ_IP:$CPANEL_APACHE_PROXY_REQ_PORT; | |
} | |
location ~ \.(gif|jpg|jpeg|png|css|js|svg|webm|webp)$ { | |
expires 30d; | |
add_header Vary Accept-Encoding; | |
access_log off; | |
tcp_nodelay off; | |
sendfile on; | |
sendfile_max_chunk 2m; | |
try_files $uri $uri/ @httpd_fallback; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment