Help Nhờ fix lỗi https xenforo trên Nginx

dakhucquan.net

MasterCorporal
Tham gia
27/06/2015
Bài viết
336
Được Like
151
Trên hosting share ip thì chạy ngon ơ, mới quất cái vps 1 năm mò chạy xf vs nginx mò cả 2 tiếng đồng hồ ko đc gì :-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@

file domain trong nginx e nó vầy:


server {
listen 80;

server_name www.domain.com;
rewrite ^(.*) https://domain.com$1 permanent;
}


và e thêm chử S vào chổ màu đỏ í,
Lưu lại và
service nginx restart

giờ chạy vào cloudflare.com

SSL = Fixible
Always use HTTPS = On
Origin Certificates = Nginx


http thì chạy ok phà phà, còn https vẩn ko chạy các bác ạ, => nứt giao diện. bác nào fix đc cứu e với

cám ơn các bác nhiều.
 
Sửa lần cuối:
  • Like
Reactions: THB

thebigsize

MasterCorporal
Tham gia
04/03/2015
Bài viết
327
Được Like
250
Trên hosting share ip thì chạy ngon ơ, mới quất cái vps 1 năm mò chạy xf vs nginx mò cả 2 tiếng đồng hồ ko đc gì :-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@:-@

file domain trong nginx e nó vầy:


server {
listen 80;

server_name www.domain.com;
rewrite ^(.*) https://domain.com$1 permanent;
}


và e thêm chử S vào chổ màu đỏ í,
Lưu lại và
service nginx restart

giờ chạy vào cloudflare.com

SSL = Fixible
Always use HTTPS = On
Origin Certificates = Nginx


http thì chạy ok phà phà, còn https vẩn ko chạy các bác ạ, => nứt giao diện. bác nào fix đc cứu e với

cám ơn các bác nhiều.
Cái cloudflare thì ko rành lắm nhưng config ssl nginx bạn thử:
Mã:
server {
listen 80;
server_name domain.com www.domain.com;
rewrite ^(.*) https://domain.com$1 permanent;
}
server {
    listen       443 ssl http2;
    server_name  www.domain.com;
    return       301 https://domain.com$request_uri;
ssl_certificate link đến chứng chỉ/domain.com.crt;
ssl_certificate_key /link đến khóa/tdomain.com.key;
......
 

dakhucquan.net

MasterCorporal
Tham gia
27/06/2015
Bài viết
336
Được Like
151
Cái cloudflare thì ko rành lắm nhưng config ssl nginx bạn thử:
Mã:
server {
listen 80;
server_name domain.com www.domain.com;
rewrite ^(.*) https://domain.com$1 permanent;
}
server {
    listen       443 ssl http2;
    server_name  www.domain.com;
    return       301 https://domain.com$request_uri;
ssl_certificate link đến chứng chỉ/domain.com.crt;
ssl_certificate_key /link đến khóa/tdomain.com.key;
......
xài ssl free của cloudflare.com thì sửa link làm sao bác, e thấy có đoạn txt trong
Origin Certificates thôi

làm theo hd này củng chịu bác ak

https://support.cloudflare.com/hc/en-us/articles/217471977
 
Sửa lần cuối:
  • Like
Reactions: THB

dakhucquan.net

MasterCorporal
Tham gia
27/06/2015
Bài viết
336
Được Like
151
Bạn cho mình xem demo lôiz thử nhé. Có gì ib mình fix cho nhé!
file e nó vầy, bác coi chỉ giúp e vs. tại ko biết bác ol giờ nào mà nhờ bác team qua coi dùm e xí

Mã:
server {
    listen 80;
    
    server_name www.domain.com;
    rewrite ^(.*) https://domain.com$1 permanent;
}

server {
    listen 80 default_server;
        
    # access_log off;
    access_log /home/domain.com/logs/access.log;
    # error_log off;
        error_log /home/domain.com/logs/error.log;
    
        root /home/domain.com/public_html;
    index index.php index.html index.htm;
        server_name domain.com;
 
        location / {
        try_files $uri $uri/ /index.php?$args;
    }
    
    # Custom configuration
    include /home/domain.com/public_html/*.conf;
 
        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 1000;
        fastcgi_send_timeout 1000;
        fastcgi_read_timeout 1000;
        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 $document_root$fastcgi_script_name;
        }
    
    location /nginx_status {
          stub_status on;
          access_log   off;
        allow 127.0.0.1;
        allow 107.175.219.224;
        deny all;
    }
    
    location /php_status {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        allow 127.0.0.1;
        allow 107.175.219.224;
        deny all;
        }
    
    # Disable .htaccess and other hidden files
    location ~ /\.(?!well-known).* {
        deny all;
        access_log off;
        log_not_found off;
    }
    
        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }
    
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    
    location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|eot|svg|ttf|woff)$ {
            gzip_static off;
        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
        }

        location ~* \.(txt|js|css)$ {
            add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
        }
}

server {
    listen 3889;
    
     access_log off;
    log_not_found off;
     error_log /home/domain.com/logs/nginx_error.log;
    
        root /home/domain.com/private_html;
    index index.php index.html index.htm;
        server_name domain.com;
 
    auth_basic "Restricted";
    auth_basic_user_file /home/domain.com/private_html/hocvps/.htpasswd;
    
    location / {
        autoindex on;
        try_files $uri $uri/ /index.php;
    }
    
        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 1000;
        fastcgi_send_timeout 1000;
        fastcgi_read_timeout 1000;
        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 $document_root$fastcgi_script_name;
        }
    
    location ~ /\. {
        deny all;
    }
}
 
  • Like
Reactions: THB

dakhucquan.net

MasterCorporal
Tham gia
27/06/2015
Bài viết
336
Được Like
151
mất 1 ngày thôi :)). thử đủ kiểu, cuối cùng là chỉ thiếu 1 dòng này:
$_SERVER['HTTPS'] = 'on';

:))))))) trên hostting cpanel sao ko cần mà trên nginx củng ko thấy ai nhắc đến luôn. bó tay

file trên nginx của e chạy ok đây cho bác nào làm ko đc:

server {
listen 80;
listen 443;

ssl on;
ssl_certificate /etc/ssl/certificate.pem;
ssl_certificate_key /etc/ssl/key.key;

server_name www.temien.com;
rewrite ^(.*) https://temien.com$1 permanent;

}

server {
listen 80 default_server;
.......................................
..............


Nếu thêm dòng $_SERVER['HTTPS'] = 'on'; vào mà ko chạy đc thì thêm mớ in đậm trên vào file domain.com.conf
còn nếu chạy thì khỏi thêm
file in đậm + nghiêng thì các bác tự copy trong cloudflare rồi bỏ vào.
 
Sửa lần cuối:

THB

Founder
Thành viên BQT
Tham gia
25/02/2015
Bài viết
6,650
Được Like
3,939
xin chào mọi người.
mình dùng ssl của cloud thì hay thêm dòng này vào trong config.php
$_SERVER['HTTPS'] = 'on';
 

dakhucquan.net

MasterCorporal
Tham gia
27/06/2015
Bài viết
336
Được Like
151
xin chào mọi người.
mình dùng ssl của cloud thì hay thêm dòng này vào trong config.php
các bác giấu thôi :)) làm mò gg mãi mới đó bác.

Bác @THB xử dùm e cái này vs đc ko bác :D
Như site e: e muốn khi ctrl + lăn chuột thì cái hình bg của header nó tự động nằm ngay giữa khi thu phóng đc ko bác? + cái logo nằm yên nữa chứ nó chạy lung tung quá. E thêm css lung tung mãi mà ko đc như ý. :D
 
Sửa lần cuối:
  • Like
Reactions: THB

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mr. Tuấn

Mobile/Zalo: 0988 488 096

Telegram: bluekpro

Email: [email protected]

Nhà Tài Trợ

Mút Xốp Không Gian
pallet Thịnh Phát
Top Bottom