Skip to content

Instantly share code, notes, and snippets.

@ger86
Created December 15, 2017 12:55
Show Gist options
  • Save ger86/6dc403f06e94127442d9f39502dbaf56 to your computer and use it in GitHub Desktop.
Save ger86/6dc403f06e94127442d9f39502dbaf56 to your computer and use it in GitHub Desktop.
File config for Nginx when using Wordpress with Composer
server {
listen 80;
server_name domain
root /var/www/vhosts/domain;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) /wp$2 last;
rewrite ^(/[^/]+)?(/.*\.php)$ /wp$2 last;
}
location / {
try_files $uri $uri/ /index.php?$args;
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment