http to https ยังไงครับ

เริ่มโดย mr.zatan, 01 กุมภาพันธ์ 2020, 15:27:33

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

mr.zatan

http to https ยังไงครับ


wordpress (nginx + php-fpm)


ไม่ redirect เป็น https ให้ครับ  ไม่รู้จะทำไงดี


iCafe

add

server {
        server_name domain.com www.domain.com;
    listen 80;
    return 301 https://$host$request_uri;
}
ขายครับ [direct=https://www.uppic.org/]ฝากรูปฟรี อับรูปฟรี อับโหลดรูปฟรี[/direct] พร้อมสคิป

Mrpoohling

ลองเพิ่ม code นี้เข้าไปใน .htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^โดเมน\.คอม [NC]
RewriteRule ^(.*)$ https://www.โดเมน.คอม/$1 [L,R=301]
</IfModule>

ถ้าไม่ได้ลอง plugin really-simple-ssl ครับ
[direct=https://c.lazada.co.th/t/c.bfS0An]9.9 จัดเต็มลดกระหน่ำ[/direct]

mean

วิธีตั้งค่า Redirect เว็บไซต์ HTTP:// to HTTPS:// โดยใช้ Code PHP
https://www.ireallyhost.com/kb/ssl/380

วิธีตั้งค่า Redirect เว็บไซต์ HTTP:// to HTTPS:// โดยใช้ .htaccess - ละเอียด
https://www.ireallyhost.com/kb/ssl/379

วิธีการตั้งค่า Wordpress ใช้งาน HTTPS:// , SSL อย่างละเอียด
https://www.ireallyhost.com/kb/ssl/413


[direct=https://www.ireallyhost.com/]บริการโดเมน, เว็บโฮสติ้ง, SSL Certificate[/direct]
[direct=https://www.ireallyhost.com/ssl]บริการ SSL Certificate , HTTPS สำหรับเว็บไซต์[/direct]
[direct=https://www.ireallyhost.com/]บริการ Web Hosting Free! Domain name ตลอดอายุบริการ [/direct]
[direct=https://www.ireallyhost.com/domain]บริการ จดโดเมน, Free DNS Service, Domain Forwarding, จัดการโดเมนได้เอง Domain Control Panel[/direct

wiriyaarmz

อ้างถึงจาก: Mrpoohling ใน 01 กุมภาพันธ์ 2020, 16:53:37
ลองเพิ่ม code นี้เข้าไปใน .htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^โดเมน\.คอม [NC]
RewriteRule ^(.*)$ https://www.โดเมน.คอม/$1 [L,R=301]
</IfModule>

ถ้าไม่ได้ลอง plugin really-simple-ssl ครับ

.htaccess  เป็น config file ของ Apache ครับ เจ้าของโพสบอกไว้ด้านบนว่าใช้ nginx ครับ

BrainFreeze

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}


ใส่ที่ nginx.conf แล้ว reload สักทีครับ
# จัดไป Promo Code ลด 11% : THAISEOBOARD
# [direct=https://www.hostatom.com]hostatom.com[/direct] |โฮสอะตอม - เว็บโฮสติ้งที่ Webmaster มืออาชีพไว้วางใจ
# [direct=https://www.hostatom.com/web-hosting]Web Hosting[/direct] | [direct=https://www.hostatom.com/cloud-vps]Cloud VPS[/direct] | [direct=https://www.hostatom.com/reseller-hosting]Reseller Hosting[/direct] | [direct=https://www.hostatom.com/domain-name]Domain Name[/direct]
# บริการ 24x7 | รับประกันความพอใจยินดีคืนเงิน | Uptime 99.9% | โทร : 0-2107-3466

mr.zatan

อ้างถึงจาก: BrainFreeze ใน 01 กุมภาพันธ์ 2020, 20:50:38
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}


ใส่ที่ nginx.conf แล้ว reload สักทีครับ

เพิ่มทั้งหมดมัย หรือว่าแค่ return 301 https://$host$request_uri; ครับ

iCafe

#7
อ้างถึงจาก: mr.zatan ใน 02 กุมภาพันธ์ 2020, 06:06:54
อ้างถึงจาก: BrainFreeze ใน 01 กุมภาพันธ์ 2020, 20:50:38
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}


ใส่ที่ nginx.conf แล้ว reload สักทีครับ

เพิ่มทั้งหมดมัย หรือว่าแค่ return 301 https://$host$request_uri; ครับ

ทั้งหมดครับ
ขายครับ [direct=https://www.uppic.org/]ฝากรูปฟรี อับรูปฟรี อับโหลดรูปฟรี[/direct] พร้อมสคิป

mr.zatan

#8
nginx.conf
nginx.ssl.conf

Code เดิมที่มีอยู่ตอนนี้

อ้างถึง

server {
   listen      172.0.0.0:80;
   server_name xxxx.com www.xxxx.com;
   root        /home/admin/web/xxxx.com/public_html;
   index       index.php index.html index.htm;
   access_log  /var/log/nginx/domains/xxxx.com.log combined;
   access_log  /var/log/nginx/domains/xxxx.com.bytes bytes;
   error_log   /var/log/nginx/domains/xxxx.error.log error;


//เพิ่มแบบนี้เหรอครับ
server {
   listen 80 default_server;
   listen [::]:80 default_server;
   server_name _;
   return 301 https://$host$request_uri;
}


   location / {

       location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
           expires     max;
       }

location / {
   try_files $uri $uri/ /index.php?$args;
}

location /ecatalogs/ {
   try_files $uri $uri/ /catalogs/index.php?$args;
}

       location ~ [^/]\.php(/|$) {
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           if (!-f $document_root$fastcgi_script_name) {
               return  404;
           }

           fastcgi_pass    127.0.0.1:9001;
           fastcgi_index   index.php;
           include         /etc/nginx/fastcgi_params;
       }
   }

   error_page  403 /error/404.html;
   error_page  404 /error/404.html;
   error_page  500 502 503 504 /error/50x.html;