Skip to content

Instantly share code, notes, and snippets.

@benhartwich
Last active August 29, 2015 14:11
Show Gist options
  • Save benhartwich/983e6b190ea2b10ca094 to your computer and use it in GitHub Desktop.
Save benhartwich/983e6b190ea2b10ca094 to your computer and use it in GitHub Desktop.
WordPress nginx.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name test.de www.test.de;
root /var/www/httpdocs;
index index.php;
client_max_body_size 30m;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ ^(.+\.php)($|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
try_files $uri =404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 7200;
fastcgi_buffer_size 16k;
fastcgi_buffers 16 16k;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
rewrite ^/files/(.+) /wp-includes/ms-files.php?file=$1 last;
location ^~ /files/ {
rewrite ^.*/files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
include drop.conf;
include wordpress-sec.conf;
}
server {
listen 80;
listen [::]:80;
server_name nichteinschalten.de www.nichteinschalten.de xy.nichteinschalten.de;
root /var/www/httpdocs;
client_max_body_size 35m;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
index index.php;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ ^(.+\.php)($|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
try_files $uri =404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 7200;
fastcgi_buffer_size 16k;
fastcgi_buffers 16 16k;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
include drop.conf;
include wordpress-sec.conf;
}
server {
listen 80;
listen [::]:80;
server_name xy.de www.xy.de;
root /var/www/html/website;
client_max_body_size 30m;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
try_files $uri =404;
fastcgi_param PHP_VALUE "upload_max_filesize = 36M";
fastcgi_param PHP_VALUE "post_max_size=37M";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
fastcgi_connect_timeout 60;
fastcgi_index index.php;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires max;
log_not_found off;
}
include drop.conf;
include wordpress-sec.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment