Created
September 7, 2017 13:53
-
-
Save mgussekloo/a21a1128b121c5b58e0262c16ba1d47e to your computer and use it in GitHub Desktop.
NGINX configuration for Symphony CMS
This file contains hidden or 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
| location / { | |
| index index.php; | |
| ### main rewrite | |
| try_files $uri $uri/ /index.php?symphony-page=$uri&$args; | |
| } | |
| # Symphony admin redirects | |
| location ~ ^/symphony(/?.*)$ { | |
| # If not requesting assest files... | |
| if (!-f $request_filename) { | |
| # ...internal redirect Symphony admin, which in turn will redirect to... | |
| rewrite ^/symphony/?$ /index.php?mode=administration&$query_string last; | |
| # ...some admin page. | |
| rewrite ^/symphony(/(.*/?))?$ /index.php?symphony-page=$1&mode=administration&$query_string last; | |
| } | |
| } | |
| # Any request to /images/ that is not a real file, send it to JIT | |
| location ~ ^/image/(.*)$ { | |
| try_files $uri $uri/ /extensions/jit_image_manipulation/lib/image.php?param=$1; | |
| } | |
| # Expiry headers for static assets | |
| location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
| expires 1y; | |
| log_not_found off; | |
| access_log off; | |
| add_header Vary Accept-Encoding; | |
| } | |
| # Hide GIT related files | |
| location ~ /\.git { | |
| deny all; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment