Welcome! Log In Create A New Profile

Advanced

подскажите по конфигу nginx для joomla 2.5

Posted by Egor 
подскажите по конфигу nginx для joomla 2.5
July 31, 2012 12:35AM
Здравствуйте, уважаемые эксперты.
Имеется сервер intel i7 920, 8gb ram, ос centos 6.3
Сделал сайт на джумле 2.5 + мост на phpbb

Выложу мой рабочий конфиг нжинкса, можете подсказать допущенные ошибки?

И что еще можно сделать, чтобы ускорить джумлу?

Заранее спасибо

user nginx;
worker_processes 6;
worker_rlimit_nofile 16384;

error_log /var/log/nginx/error.log;

pid /var/run/nginx.pid;
timer_resolution 100ms;

events {
worker_connections 20480;
use epoll;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
client_max_body_size 100m;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
expires max;
gzip on;
gzip_static on;
gzip_vary on;
gzip_comp_level 5;
gzip_proxied any;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6].(?!.*SV1)";
limit_conn_zone $binary_remote_addr zone=addr:10m;

# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;

server {
limit_conn addr 10;
listen 80;
server_name mysite.ru www.mysite.ru;
server_name_in_redirect off;
access_log /var/log/nginx/host.access.log main;
charset utf-8;
root /var/www/mysite.ru;
index index.php index.html index.htm;
allow all;
if ($request_filename ~ /forum(\/?)$){
rewrite ^(.*)$ /forum/main redirect;
}
if ($request_filename ~ /fmbb(\/?)$){
rewrite ^(.*)$ /forum/main redirect;
}
if ($request_filename ~ /fmbb/index.php){
rewrite ^(.*)$ /forum/main?$query_string redirect;
}
if ($request_filename ~ /fmbb/ucp.php){
rewrite ^(.*)$ /forum/user?$query_string redirect;
}
if ($request_filename ~ /fmbb/viewforum.php){
rewrite ^(.*)$ /forum/forum?$query_string redirect;
}
if ($request_filename ~ /fmbb/viewtopic.php){
rewrite ^(.*)$ /forum/topic?$query_string redirect;
}
if ($request_filename ~ /fmbb/memberlist.php){
rewrite ^(.*)$ /forum/members?$query_string redirect;
}
if ($request_filename ~ /fmbb/report.php){
rewrite ^(.*)$ /forum/report?$query_string redirect;
}
if ($request_filename ~ /fmbb/posting.php){
rewrite ^(.*)$ /forum/post?$query_string redirect;
}
if ($request_filename ~ /fmbb/mcp.php){
rewrite ^(.*)$ /forum/moderator?$query_string redirect;
}


# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}

location / {
root /var/www/mysite.ru;
index index.php index.html index.htm;
try_files $uri $uri/ @joomla;
}


location ~* (/|\.html?|\.feed|\.pdf|\.raw|/[^.]*)$ {
try_files $uri $uri/ @joomla;
}

location ~ \.php$ {
try_files $uri @joomla;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}

location ~ \.(php|htm|html)$ {
try_files $uri @joomla;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}



location @joomla {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

}

location ~ (^/dle/(app/|includes/|lib/|/pkginfo/|var/|report/config.php)|/\.svn/|/.hta.+) {
deny all;
}

location ^~ /drv/ {
root /var/mysite.ru/drv/;
internal;
}

location ^~ /cli/ {
root /var/mysite.ru/cli/;
internal;
}

location ^~ /includes/ {
root /var/mysite.ru/includes/;
internal;
}

location ^~ /language/ {
root /var/mysite.ru/language/;
internal;
}

location ^~ /libraries/ {
root /var/mysite.ru/libraries/;
internal;
}

location ^~ /logs/ {
root /var/mysite.ru/logs/;
internal;
}

location ^~ /tmp/ {
root /var/mysite.ru/tmp/;
internal;
}

location /administrator/ {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
allow xxx.xxx.xxx.xxx;
deny all;
}


location ~ /\.ht {
deny all;
}

location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ {
root /var/www/mysite.ru;
access_log off;
expires 7d;
}

location = /favicon.ico {
log_not_found off;
access_log off;
expires 1y;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;

}

}
}
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 117
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready