Nginx - Joomla
borgita
nginx-forum at nginx.us
Tue Apr 24 16:14:44 UTC 2012
I've tried lots of things in the file nginx.conf. The server is now more
stable. In php settings that are required to include?
nginx.conf
#user nobody;
master_process on;
worker_processes 2;
events {
worker_connections 1024;
}
http {
sendfile on;
client_max_body_size 10M;
tcp_nopush off;
tcp_nodelay on;
server_tokens off;
include /nginx/conf/mime.types;
default_type application/octet-stream;
index index.php index.htm index.html redirect.php;
charset utf-8;
keepalive_timeout 65;
#Gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_types text/plain text/css application/json
application/x-javascript text/xml
application/xml application/xml+rss
text/javascript;
#FastCGI
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
upstream fastcgi_backend {
server 127.0.0.1:9000 weight=2;
server 127.0.0.1:9001 weight=3;
server 127.0.0.1:9002 weight=4;
}
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
server {
listen 80;
server_name xxx.pt www.xxx.pt;
server_name_in_redirect off;
large_client_header_buffers 4 8k; # prevent some 400 errors;
error_log /nginx/xxx.log;
root html;
location / {
root html;
try_files $uri $uri/ /index.php?p=$uri&$args;
expires 30d;
error_page 404 = @joomla;
error_page 500 502 503 504 = @joomla;
log_not_found off;
}
location @joomla {
rewrite ^(.+)$ /index.php?p=$1 last;
}
location ~ \.php$ {
root html;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
c:/nginx/html/$fastcgi_script_name;
fastcgi_keep_conn on;
fastcgi_intercept_errors on;
if ($uri !~ "^/images/") {
fastcgi_pass fastcgi_backend;
}
include fastcgi_params;
}
if ( $args ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3d)" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}
if ( $args ~ "base64_encode.*\(.*\)" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}
if ( $args ~ "(\<|%3C).*script.*(\>|%3E)" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}
if ( $args ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}
if ( $args ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;
}
location ~* \.(ico|pdf|flv)$ {
access_log off;
expires 1y;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~*
\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
access_log off;
expires 14d;
}
# fim
location ~ \.php$ {
deny all;
}
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,225707,225715#msg-225715
More information about the nginx
mailing list