Home>Article>Backend Development> How to change website to https in php

How to change website to https in php

藏色散人
藏色散人 Original
2021-11-10 09:14:59 1925browse

php method to change the website to https: 1. Apply for a free certificate in the Alibaba Cloud CA certificate; 2. Check the certificate status; 3. Modify the domain name configuration file.

How to change website to https in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

php How to change the website to https?

php Convert http to https Mini program deployment is online

Wow,,,,, I have been doing this for a long time! ! ! It’s actually very, very simple! ! ! !

The first time I contacted, I was confused, but then suddenly it was ok after I tried it. I could access https. I started getting a lot of errors, such as 502 Bad Gateway, 404 Not Found, etc. Error,,,, everyone said it was a configuration issue. Baidu later said it was a browser, firewall, and a series of other issues. I tried a lot, but it turned out not to be the case. It had nothing to do with those things! ! ! I hope the following operations will be helpful to PHP members. My configuration is Ubuntu, but it is all done under Linux. Centos should also be able to do it! ! ! ! ! I see that Java only writes it into another server! Just follow the steps! ! ! So it doesn’t matter~~~~·Hurry up and try it!

1. Go to Alibaba Cloud CA Certificate to apply for a free certificate, click Complete, and fill in your domain name! ! ! In order to facilitate access to the mini program account, but when filling in personal information, be sure to check the box, otherwise the review will take a long time and it may not be successful! ! ! Just follow the steps to apply.

##2. When passed, its certificate status will change to issued, and then click the download on the right to operate https! There is a step-by-step tutorial above, just follow it

#3. Find the configuration file for your domain name and edit it, and enter your Edit the configuration file (the configuration file here is the location of your domain name configuration file, whether it is a first-level domain name or a second-level domain name)

4. Enter the configuration file For configuration inside, I put the 80 port and the 443 port together. At first, I rewrote a server and wrote the steps for applying for the certificate below. Save and exit. A 502 error was reported, or it was a 404 error, which made my whole head feel big. Then I tried the following method and the result was successful

# nginx -t Check whether the configuration is correct

# service nginx restart Restart the configuration file

#5. After configuring and restarting, access the browser. If you can successfully access https, it means you are successful, and then enter the merchant. Use the public platform to upload the front-end code of the mini program. Open the WeChat mini program editor and click Upload

Please note that before uploading, you must change the mini program appid to that of the merchant, and then change the linked backend data address to https://domain name before uploading, otherwise scan with your mobile phone There is no data when logging in.

6. Enter the public platform to log in. After logging in, click Development Settings in Settings on the left sidebar to set the server domain name and fill in the domain name. is the domain name of your server

Then the following depends on your mood, set it if you want,,, and then click on Development Management. For the development version at the bottom, first click on the lower left corner of the uploaded project. For the trial version, please scan and check that there are no problems before clicking to submit for review and other operations! ! ! ! ! ! ! ! You're done, take a rest~~~~~~

Expand and see if you reported the following error! ! ! !

1. 502 Bad Gateway Error

404 Not Found Error

They say my configuration is wrong. I still don’t know what the error is. Then I went to the error log and the following error was reported.

Still can’t figure it out. What is this error? I have no solution... I was frustrated for a long time! ! ! ! !

Here is another way of writing that a friend introduced,,, let me show you~~~~~~~~~

##Then I can’t access the server,,,, you can try,, anyway, I am like this

The writing methods of JAVA are similar (I have tried them all)

Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of How to change website to https in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn