ini 最小的Nginx配置文件到WordPress
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini 最小的Nginx配置文件到WordPress相关的知识,希望对你有一定的参考价值。
server {
listen XX.XX.XX.XX:80;
server_name mysite.ru;
root /var/www/mysite.ru;
index index.php index.html index.htm;
error_log /var/log/nginx/mysite.ru_error.log;
access_log /var/log/nginx/mysite.ru_access.log main;
set $fastcgipass unix:/var/lib/php5-fpm/mysite.sock;
## Disable .htaccess and other hidden files
location ~* /\.(ht|svn|hg) {
deny all;
access_log off;
log_not_found off;
}
## Disable .gitignore file and .git directory
location ~ (/\.gitignore|/\.git) {
deny all;
access_log off;
log_not_found off;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|exe|xls|doc|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mov)$ {
expires 14d;
access_log off;
log_not_found off;
}
location ~* ^.+\.(css|js)$ {
expires 24h;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* /(images|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
deny all;
access_log off;
log_not_found off;
}
location ~* /wp-content/.*\.php$ {
deny all;
access_log off;
log_not_found off;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
access_log off;
log_not_found off;
}
location ~ /wp-config.php {
deny all;
access_log off;
log_not_found off;
}
location ~ /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri @cms;
include /etc/nginx/fastcgi_params;
fastcgi_pass $fastcgipass;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location @cms {
fastcgi_pass $fastcgipass;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include /etc/nginx/fastcgi_params;
}
}
以上是关于ini 最小的Nginx配置文件到WordPress的主要内容,如果未能解决你的问题,请参考以下文章