Welcome! Log In Create A New Profile

Advanced

problem with https and www rewrite

Posted by krzysztof86 
problem with https and www rewrite
July 28, 2012 01:20PM
Project run on Symfony 2. I set for /login and /register routes option with https. But
When i click login options, and there is no https. I write login and password, and click submit, and there is HTTP.
i want www.xxxxxx.pl/register/ xxxxxx.pl/register www.xxxxxx.pl/login xxxxxx.pl/login views to be HTTPS. SSL certificates are configured correctly when i manualny write : https://xxxxxx.pl/login works, but theres no non www to www.
Is there any specialist who know what is wrong with my /etc/nginx/site-enabled/default file, and help me to set it correctly? I can check your suggestions.
Best regards
Krzysztof

default file:

server {
listen 80;

server_name *.dev;
root /var/www/xxxxxx.pl/web;

if ( $scheme = "https" ) {
rewrite ^/(.*)$ https://$host/$1 permanent;
}


if ($host != www.xxxxxx.pl)
{
rewrite ^(.*)$ http://www.xxxxxx.pl$1 permanent;
}





access_log /var/log/nginx/slubnaglowie.pl.access.log;
error_log /var/log/nginx/error.log error;

# strip app.php/ prefix if it is present
rewrite ^/app\.php/?(.*)$ /$1 permanent;

location / {
root /var/www/xxxxxx.pl/web/;
index app.php, index.html;
try_files $uri @rewriteapp;
}

location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ ^/(app|app_dev)\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}

location ~ \.php {
# try_files $uri =404;

fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;

include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~ /\.ht {
deny all;
}
}




server {
server_name *.dev;
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/xxxxxx.pem;
ssl_certificate_key /etc/nginx/ssl/xxxxxx.key;
ssl_protocols TLSv1;
ssl_prefer_server_ciphers on;
ssl_ciphers RC4-SHA:HIGH:!kEDH;

root /var/www/xxxxxx.pl/web;







access_log /var/log/nginx/xxxxxx.pl.access.log;
error_log /var/log/nginx/error.log error;

# strip app.php/ prefix if it is present
rewrite ^/app\.php/?(.*)$ /$1 permanent;

location / {
root /var/www/xxxxxx.pl/web/;
index app.php, index.html;
try_files $uri @rewriteapp;
}

location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ ^/(app|app_dev)\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}

location ~ \.php {
# try_files $uri =404;

fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;

include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~ /\.ht {
deny all;
}



}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 178
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