Welcome! Log In Create A New Profile

Advanced

zend framework + nginx rewrite + https

Posted by uri 
uri
zend framework + nginx rewrite + https
February 05, 2011 01:29PM
Добрый день!
Есть сайт писанный на zend framework. Соответственно под него написаны реврайты под nginx.
При заходе на somedomen.com/admin/ необходимо делать реврайт на https. Сайт по https работает, но вот почему-то реврайт на него не срабатывает. Хотя на этом же сервере на тестовом домене, где нету правил для zend framework - реврайт срабатывает.
Реврайты писал сам, опыта мало. Подскажите где делаю не так?
Спасибо!

[code]
server {
listen 80;
server_name agent1.somedomen.com www.agent1.somedomen.com;
access_log /var/log/nginx/agent1.somedomen.com-access_log main;
error_log /var/log/nginx/agent1.somedomen.com-error.log;

location /admin/ {
if ( $scheme = 'http' ) {
rewrite ^/(.*) https://$host/$1 last;
}
}

location / {
root /var/www/html/agents.somedomen.com;
index index.html index.htm index.php;

if (-f $request_filename) {
break;
}

if ($uri ~ ''){
rewrite ^/.*$ /html/index.php last;
}
}


if ($uri !~ ^/html/.*$){
rewrite ^/(.*)$ /html/$1 last;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/html/agents.somedomen.com$fastcgi_script_name;
include fastcgi_params_agents;
}

location ~ /\.ht {
deny all;
}

location ~ ^deployer.bin$ {
deny all;
}
}

server {
listen 443;
server_name agent1.somedomen.com www.agent1.somedomen.com;
access_log /var/log/nginx/agent1.somedomen.com-access_log main;
error_log /var/log/nginx/agent1.somedomen.com-error.log;

include /etc/nginx/ssl.conf;

location / {
root /var/www/html/agents.somedomen.com;
index index.html index.htm index.php;

if (-f $request_filename) {
break;
}

if ($uri ~ ''){
rewrite ^/.*$ /html/index.php last;
}
}

if ($uri !~ ^/html/.*$){
rewrite ^/(.*)$ /html/$1 last;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/html/agents.somedomen.com$fastcgi_script_name;
include fastcgi_params_agents;
}

location ~ /\.ht {
deny all;
}

location ~ ^deployer.bin$ {
deny all;
}
}
[/code]
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 284
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready