• Lỗi khi muốn sử dụng đường dẫn có www và chứng chỉ SSL miễn phí

  • Chia sẻ kinh nghiệm sử dụng VPS, Hỏi & Trả lời ...

Chia sẻ kinh nghiệm sử dụng VPS, Hỏi & Trả lời ...
 #5843  by biro
 17 Mar 2019 19:01
Tôi có add 1 tên miền vào VPSSIM, tôi muốn cấu hình nó có dạng https://www.domain.com, tôi đã sử dụng chức năng cài chứng chỉ SSL miễn phí của VPSSIM, tôi đã thử cấu hình lại file cấu hình của NGINX nhưng không thành công, tôi đã cấu hình như sau :
server {
listen 80;
server_name brandcare.vn www.domain.com;
return 301 https://www.domain.com$request_uri;
}
server {
listen 443 ssl http2;
server_name domain.com;
ssl_certificate /etc/nginx/auth-acme/www.domain.com/domain.com.crt;
ssl_certificate_key /etc/nginx/auth-acme/www.domain.com/domain.com.key;
ssl_trusted_certificate /etc/nginx/auth-acme/www.domain.com/domain.com.ca;
return 301 https://www.domain.com$request_uri;
}
server {
listen 443 ssl http2;
server_name www.domain.com;
ssl_certificate /etc/nginx/auth-acme/www.domain.com/domain.com.crt;
ssl_certificate_key /etc/nginx/auth-acme/wwwdomain.com/domain.com.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
include /etc/nginx/conf/ssl-protocol-cipher.conf;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 30s;
ssl_trusted_certificate /etc/nginx/auth-acme/www.domain.com/domain.com.ca;
ssl_buffer_size 1400;
ssl_session_tickets on;
add_header Strict-Transport-Security max-age=31536000;
access_log off;
access_log /home/domain.com/logs/access_log;
error_log off;
error_log /home/domain.com/logs/error.log;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
root /home/domain.com/public_html;
include /etc/nginx/conf/ddos2.conf;
index index.php index.html index.htm;
server_name domain.com;

#///////////////////////////////////////////////////////
# Ban chi co the chon 1 trong 4 rule AAA, BBB, CCC, DDD, EEE hoac FFF
# Ban nen comment cac rule khong su dung thay vi xoa chung vi neu ban su dung wordpress blog
# Cac dong nay can thiet cho cac chuc nang trong Wordpress Blog Tools cua VPSSIM
# Thuat ngu:
# Comment - Them dau # vao truoc
# Uncomment - Bo dau # o truoc cau.
#///////////////////////////////////////////////////////


#Chay tat ca cac website (Wordpress, Xenforo, Joomla, Phpbb .... ). neu ban su dung rule cua ban,comment dong duoi (them dau # vao truoc) (AAA)
#include /etc/nginx/conf/all.conf;

#Neu ban su dung rule cua minh, comment rule o tren. Sau do uncoment (bo dau # ba dong duoi) sau do them rule vao giua. (BBB)
#location / {
#Uncomment 3 dong nay, sau do cho rule cua ban vao day!
#}

# Rule cho wordpress + Plugin wp super cache. Neu ban su dung wordpress va wp super cache, uncomment dong duoi va comment dong AAA phia tren. (CCC)
#include /etc/nginx/conf/supercache.conf;

# Rule cho wordpress + Plugin W3 Total Cache. Neu ban su dung wordpress va W3 Total, uncomment dong duoi va comment dong AAA phia tren. (DDD)
#include /etc/nginx/conf/w3total.conf;

# Rule cho wordpress + WP-Rocket. Neu ban su dung wordpress va WP-Rocket, uncomment dong duoi va comment dong AAA phia tren. (EEE)
#include /etc/nginx/conf/wprocket.conf;

# Rule cho wordpress + Plugin wp fastest cache. Neu ban su dung wordpress va wp fastest cache, uncomment dong duoi va comment dong AAA phia tren. (FFF)
include /etc/nginx/conf/wp-fastest-cache.conf;

# Config Cache Static Files
include /etc/nginx/conf/staticfiles.conf;

#Tang bao mat security, chong sql injection ....(uncoment neu ban muon su dung). Boi vi mot so code website khong su dung duoc voi rule nay, nen mac dinh VPSSIM de tat.
#Khong duoc xoa dong duoi, neu xoa VPSSIM se khong hoat dong !
#include /etc/nginx/conf/block.conf;

# Config for Free SSL (LetEncrypt) - Do not Delete !
location ~ /.well-known {
allow all;
root /home/domain.com/public_html;
}

# Error Page
#error_page 403 /errorpage_html/403.html;
#error_page 404 /errorpage_html/404.html;
#error_page 405 /errorpage_html/405.html;
#error_page 502 /errorpage_html/502.html;
#error_page 503 /errorpage_html/503.html;
#error_page 504 /errorpage_html/504.html;
#location ^~ /errorpage_html/ {
# internal;
# root /home/domain.com;
# access_log off;
#}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 250;
fastcgi_send_timeout 250;
fastcgi_read_timeout 250;
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /home/domain.com/public_html$fastcgi_script_name;
}

#include /etc/nginx/conf/phpstatus.conf;
include /etc/nginx/conf/drop.conf;

}
Mọi người giúp dỡ mình , nó ra lỗi này :
This page isn’t working www.domain.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
Get 25 USD Free To USE VPSSIM
 #5844  by olalavui
 17 Mar 2019 20:21
Show domain lên or paste dns record xem đã trỏ về IP VPS chưa?
SSL cài tự động, tự cấu hình nên nếu không có tùy chỉnh nào trong nginx thì k cần post file config lên làm gì cả
Get 25 USD Free To USE VPSSIM