My site works in both https access with www & non www. I've also changed the redirect from non www to www, and it works. All access is redirected to https://www.example.com
But, currently my website can't redirect to www even though with the same nginx default configure. Here's
server {
add_header X-Frame-Options SAMEORIGIN;
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com;
return 301 https://server_name$request_uri;}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
client_max_body_size 500M;
root /var/www/html/src/public;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
add_header X-Frame-Options SAMEORIGIN;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_nam$
include fastcgi_params;
}
location ~ /.well-known {
allow all;
}
location ~ /\.ht {
deny all;
}
}
I'm using VPS debian 8.9 x64, nginx/1.6.2
Aucun commentaire:
Enregistrer un commentaire