Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sergejmueller
Created February 22, 2012 20:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergejmueller/1887141 to your computer and use it in GitHub Desktop.
Save sergejmueller/1887141 to your computer and use it in GitHub Desktop.
Beispiel einer Server-Konfigurationsdatei für Nginx. WordPress-optimiert.
server {
## INIT
listen 80 default_server;
server_name helpdesk.wpseo.de;
## ROOT
root /var/www/helpdesk.wpseo.de;
## LOGS
error_log /var/log/nginx/helpdesk.error.log;
# DEFAULT INDEX
index index.php;
## SECURITY
if ( $request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
location ~ /(\.|wp-config.php|liesmich.html|readme.html) {
return 444;
}
## REWRITES
location ~ ^/(\d+)/$ {
return 301 /?p=$1;
}
## RESSOURCES
location ~ \.(?:ico|png|jpe?g|css|js)$ {
expires 31d;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
#location ~ \.(?!ico).+$ {
# valid_referers none blocked server_names ~(wpseo.|google.|yahoo.|bing.|facebook.|fbcdn.|pinterest.);
# if ( $invalid_referer ) {
# return 444;
# }
#}
}
## REDIRECT INDEX
location / {
try_files $uri $uri/ /index.php;
}
## PHP FILES
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
}
## AUTH ADMIN
location = /wp-login.php {
#auth_basic "Restricted";
#auth_basic_user_file /etc/nginx/htpasswd;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment