Created
June 20, 2020 01:07
-
-
Save g3luka/487afdd28b58f18572eb0543c9c64b81 to your computer and use it in GitHub Desktop.
WordPress Beanstalk Nginx Amazon Linux 2
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
location ~ ^(/[^/]+/)?files/(.+) { | |
try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ; | |
access_log off; log_not_found off; expires max; | |
} | |
#avoid php readfile() | |
location ^~ /blogs.dir { | |
internal; | |
alias /var/app/current/wp-content/blogs.dir ; | |
access_log off; log_not_found off; expires max; | |
} | |
if (!-e $request_filename) { | |
rewrite /wp-admin$ $scheme://$host$request_uri/ permanent; | |
rewrite ^(/[^/]+)?(/wp-.*) $2 last; | |
rewrite ^(/[^/]+)?(/.*\.php) $2 last; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$args ; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
# include fastcgi_params; | |
# fastcgi_pass php; | |
} |
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
map $uri $blogname { | |
~^(?P<blogpath>/[^/]+/)files/(.*) $blogpath ; | |
} | |
map $blogname $blogid { | |
default -999; | |
#Ref: https://wordpress.org/extend/plugins/nginx-helper/ | |
#include /var/app/current/wp-content/uploads/nginx-helper/map.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment