Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to give Discuz! X3.1Accord3.2 enable https

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

How to give Discuz! X3.1 https 3.2 is enabled. In view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Teach you how to give Discuz! X3.1 SSL 3.2 enable https (SSL) support! -HTTPS SSL tutorial

DZ as a community communication system: 1. Poor compatibility for higher versions of PHP 2. Poor compatibility with HTTPS 3. At present, there is no official one-click switching scheme, so we have to do it ourselves to solve this problem.

1. SSL certificate & configuration

First of all, to open SSL, you must have a certificate, right? Whether it is issued by regular CA or signed by yourself, it cannot be done without certainty. If not, apply for one first. (specific methods, please Google, I will not repeat them here)

2 、 Discuz! Optimize

2.1. Program adjustment

Since Discuz! Since X3, support for https has been added. If you use https to visit the forum, all the links in the forum will become https. If you find that most of the links have already used https, it means that Discuz has been automatically identified. At this point, you can skip this step and go straight to the next step.

Discuz uses $_ SERVER ['HTTPS'] to judge SSL, but because of VPS architecture problems (nginx+php-fpm), it is impossible to identify in this way, so you need to make some adjustments to the Discuz program (using $_ SERVER [' SERVER_PORT'] to determine).

Source/class/discuz/discuz_application.php (about line 187):

Find:

$_ G ['isHTTPS'] = ($_ SERVER [' HTTPS'] & & strtolower ($_ SERVER ['HTTPS'])! =' off')? True: false

Modified to:

$_ G ['isHTTPS'] = ($_ SERVER [' SERVER_PORT'] = = 443 | | $_ SERVER ['HTTPS'] & & strtolower ($_ SERVER [' HTTPS'])! = 'off')? True: false

Uc_server/avatar.php (about line 13):

Find:

Define ('UC_API', strtolower (($_ SERVER [' HTTPS'] = = 'on'? 'https':' http').': / /. $_ SERVER ['HTTP_HOST'] .substr ($_ SERVER [' PHP_SELF'], 0, strrpos ($_ SERVER ['PHP_SELF'],' /')

Modified to:

Define ('UC_API', strtolower (($_ SERVER [' SERVER_PORT']) = = 443 | | $_ SERVER ['HTTPS'] = =' on'? 'https':' http').': / /. $_ SERVER ['HTTP_HOST'] .substr ($_ SERVER [' PHP_SELF'], 0, strrpos ($_ SERVER ['PHP_SELF'],' /')

After modification, update the cache and find that most of the links have become https.

2.2. Background settings

There are also some settings in the background that may interfere with the use of https

Backend > webmaster > UCenter settings > UCenter access address, modified to the beginning of https

UCenter backend > Application Management > the main URL of the application, modified to start with https

In addition, some settings in backend > Global > Domain name settings may also invalidate https. If you still cannot enable it after the previous steps, you can try to delete the settings here temporarily.

3. Clean the cache

After the settings are complete, you need to clean up the cache for the settings to take effect.

Clean up the cache and memory cache. If you set up the post cache, you also need to clean the cache in the database (empty the corresponding cache database, or wait for the cache to expire)

To sum up, the purpose is to change the HTTP header to HTTPS.

At this point, Discuz https is enabled successfully, and of course, when visiting certain pages, the lock may be crossed. Because other http content is loaded on the page. It may be statistical code, QQ sharing code, QQ Show avatar, etc., this part of the service does not provide https protocol, so it cannot be enabled. You can only wait for Discuz to further support https.

About how to give Discuz! This is the answer to the question about X3.1 https 3.2. I hope the above content can be of some help to you. If you still have a lot of questions to solve, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report