server {
listen 80, 443;
server_name domain1.local, www.domain1.local;
rewrite https://domain2.local permanent;
}
server {
listen 80; # для понимания
server_name domain2.local, www.domain2.local;
rewrite https://domain2.local permanent;
}
server {
listen 443;
server_name domain2.local;
....
}
Из конфига видно, что при переходе на psql.site/ сервер должен читать /var/www/site/psql.спорное отверждение
"root" directive is not allowed here in
if ($host ~* ^([a-z0-9-\.]+)\.site$) {
root /var/www/site/$1;
}
server {
server_name psql.site;
root /var/www/site/psql;
access_log /var/log/nginx/psql.site.access.log;
error_log /var/log/nginx/psql.site.error.log;
location / {
index index.php index.html;
try_files \$uri \$uri/ /index.php?\$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
server_name site1.ru;
rewrite ^(.*) http://site2.ru/$1 permanent;
}
server {
server_name www.site.ru;
rewrite ^(.*) http://site.ru/$1 permanent;
}
server {
# listen 80; не нужно сулшать не https порт
listen 443 ssl spdy;
server_name webmail.domain.com;
можно ли сделать default host чтобы показывал его nginx в случае, когда поддомена не существует?
server_name "~^(^webmail|www)\.domain\.com$";
location /admin {
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;
}
[pool_name]
...
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 10s
pm.max_requests = 200
NetRange: 172.16.0.0 - 172.31.255.255
CIDR: 172.16.0.0/12
NetName: PRIVATE-ADDRESS-BBLK-RFC1918-IANA-RESERVED
log_format main '$remote_addr|$time_local]|$request|$request_time|$upstream_response_time|'
'$status|$body_bytes_sent|$http_referer|'
'$http_user_agent';
I include the --profiler option too
--profiler pycall
--profiler pyline
they will write function timings in the logs. You can analize logs to find
bottleneck (not an easy task, but it should be doable investing a bit of
time in log parser)
для решения моей задачи?какой задачи?
cd /var/log
ls
less nginx/nginx.log
q