Created
February 22, 2012 20:45
-
-
Save sergejmueller/1887141 to your computer and use it in GitHub Desktop.
Beispiel einer Server-Konfigurationsdatei für Nginx. WordPress-optimiert.
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
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