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

Wordpress Container SSL of Intermediate docker (external) (78)

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!

Original link address: wordpress container SSL of "Intermediate Article" docker (external article) (78)

After 2 days, I finally got it, and now I want to share it with you. Install SSL in the apache2 container to install the wordpress certificate.

Premise

"Intermediate" docker Container installation wordpress (37) wordpress and mysql have been installed in the above way, and can be accessed normally

Preparatory work

Enter the container

Container name of docker exec-it wordpress / bin/bash enable SSL

Even if one of them has a result, it will pass.

A1enmod ssl or a2enmod ssl* container installs vi and rz

Apt-get update

# Editing file usage

Apt-get install vim

# upload from the certificate applied for by Ali or Tencent Cloud or Huawei Cloud

Apt-get install lrzsz

* Certificate upload

Cd / etc/apache2

Mkdir ssl

Cd / etc/apache2/ssl

Rz

# upload three certificates of Huawei Cloud to this directory

! [] (https://upload-images.jianshu.io/upload_images/11223715-cd70cc200fc9b0c5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)* configuration / etc/apache2/sites-enabled/default-ssl.conf

# if not, copy it from / sites-available

Cp / etc/apache2/sites-available/default-ssl.conf / etc/apache2/sites-enabled/default-ssl.conf

# modify the file

Vi / etc/apache2/sites-enabled/default-ssl.conf

Make changes according to mine. Red refers to these modifications! [] (https://upload-images.jianshu.io/upload_images/11223715-e00070dbb4b651a1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)* checks the configuration to see if default-ssl.conf exists in the apache2/sites-enabled directory, and to see if ssl.conf and ssl.load exist in the apache2/mods-enabled directory. If it exists, it means no problem, if it doesn't exist. Copy it from the appropriate sites-available directory. * http request to forcibly jump to https

Vi / etc/apache2/sites-available/000-default.conf

Add the following configuration

ServerAdmin webmaster@

DocumentRoot / var/www/html

RewriteEngine on

RewriteBase /

FORCE HTTPS

RewriteCond% {HTTPS}! = on

RewriteRule ^ /? (. *) https://%{SERVER_NAME}/$1 [RMagel]

! [] (https://upload-images.jianshu.io/upload_images/11223715-32fbbc625d70a18e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) * restart apache

Service docker restart

# add port to docker wordpress container * find wordpress container

Cd / var/lib/docker/containers

! [] (https://upload-images.jianshu.io/upload_images/11223715-ae45cfd88c1ea0bb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)* back up in order to prevent you from making a mistake

Cp config.v2.json config.v2.json_bak

Cp hostconfig.json hostconfig.json_bak

! [] (https://upload-images.jianshu.io/upload_images/11223715-648cd4154d10d24b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)* stops docker

Systemctl stop docker or service docker stop

* modify and add port > originally only 80 I added 443

Vi hostconfig.json

! [] (the original https://upload-images.jianshu.io/upload_images/11223715-cd9644b0d6d3f09b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)> was only 80. I increased by 443.

Vi config.v2.json

! [] (start docker > after https://upload-images.jianshu.io/upload_images/11223715-332ed7d80fab4a59.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)* save has added 443

Systemctl start docker

! [] (add 443! [] to the https://upload-images.jianshu.io/upload_images/11223715-3f151e646e1bdc8a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)### security group (https://upload-images.jianshu.io/upload_images/11223715-f7dc826fa5c227a8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)### installation plug-in > only these two plug-ins are required! [] (https:// Upload-images.jianshu.io/upload_images/11223715-e338ebe7eb275d22.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) # finally got it > input: idig8.com automatically jumps! [] (https://upload-images.jianshu.io/upload_images/11223715-338387d705c598be.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)PS: thanks to backup on the CVM There are several times I almost couldn't get up. The articles I wrote were in vain. Be sure to back up the machine and do it to prevent you from losing a whole set of misspelled letters. Refer to https://peter.pudaite.net/2017/05/29/enabling-https-on-the-standard-wordpress-docker-image/ foreigner's writing is very steady! [] (http://upload-images.jianshu.io/upload_images/11223715-3407e1c7ac8d7935?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

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

Servers

Wechat

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

12
Report