Доброго времени суток, уважаемые форумчане. Прошу помощи «допилить» конфиг nginx. Ситуация следующая: есть серв с апачем, а на нем крутится 2 сайта (example.org, example2.org), назовем его «оригинал». Дальше, есть серв с nginx (сервер крутится в амазоновском облаке, 1,1,1,1 - его белый адресс) на котором эти же 2 сайта, назовем его «копией». Редирект на оригинале прописываю так (.htaccess для каждого сайта):
RewriteEngine ON
RewriteRule ^.*$ http://1,1,1,1/ [R=301,L]
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
timer_resolution 100ms;
worker_rlimit_nofile 8192;
worker_priority -5;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
limit_req_zone $binary_remote_addr zone=example:10m rate=3r/m;
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;
sendfile on;
#tcp_nopush on;
keepalive_timeout 35;
#
server_tokens off;
ignore_invalid_headers on;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 4k;
large_client_header_buffers 4 32k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
#
gzip on;
gzip_min_length 1100;
gzip_buffers 64 8k;
gzip_comp_level 3;
gzip_http_version 1.1;
gzip_proxied any;
gzip_types text/plain application/xml application/x-javascript text/css;
# Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;
server_names_hash_bucket_size 128;
#example.org
server {
server_name example.org www.example.org;
limit_req zone=example burst=4;
listen 80;
location / {
root /home/example/public_html;
index index.html index.htm index.php;
}
location ^~/comments/ {
root /home/example/public_html/comments;
index "index.html, index.php";
}
access_log /var/log/virtualmin/example.org_access_log;
error_log /var/log/virtualmin/example.org_error_log;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
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 SCRIPT_FILENAME /home/example/cgi-bin$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/example/public_html;
fastcgi_param SERVER_PROTOCOL $server_protocol;
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 ~ \.php$ {
#--
root /home/example;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
#--
try_files $uri =404;
#fastcgi_pass unix:/var/php-nginx/137999998116970.sock/socket;
}
fastcgi_read_timeout 30;
#
#
root /home/example/public_html;
index "index.html, index.php";
}
#example2.org
server {
server_name example2.org www.example2.org;
listen 80 default_server;
location / {
root /home/example2/public_html;
index index.html index.htm index.php;
}
location ^~/comments/ {
root /home/example2/public_html/comments;
index "index.html, index.php";
}
#index index.html index.htm index.php;
access_log /var/log/virtualmin/example2.org_access_log;
error_log /var/log/virtualmin/example2.org_error_log;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
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 SCRIPT_FILENAME /home/example2/cgi-bin$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/example2/public_html;
fastcgi_param SERVER_PROTOCOL $server_protocol;
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 ~ \.php$ {
#--
root /home/example2;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
#--
try_files $uri =404;
#fastcgi_pass unix:/var/php-nginx/13825700191983.sock/socket;
}
fastcgi_read_timeout 30;
#
#
root /home/example2/public_html;
index "index.html, index.php, index.htm, index.shtml";
}
root /home/;
index index.html, index.php, index.htm, index.,shtml;
}