How to install https certificate (ubuntu+apache2)

I tossed all night to padlock my website, and finally found a solution to the same situation as mine.

Handling self-knowledge FengYQ: https://zhuanlan.zhihu.com/p/43699640

1. Upload the apache certificate folder to the server

2. Enter the command sudo a2enmod ssl to enable the module

3. Open the file /etc/apache2/sites-enabled/000-default

**4. Add ** at the end of the file

< VirtualHost 0.0.0.0:443>
DocumentRoot "/var/www/html"
ServerName www.domain.com #Domain Information
SSLEngine on
SSLCertificateFile /usr/local/apache/conf/2_www.domain.com.crt #Location of uploaded certificate file
SSLCertificateKeyFile /usr/local/apache/conf/3_www.domain.com.key
SSLCertificateChainFile /usr/local/apache/conf/1_root_bundle.crt
< /VirtualHost>

5. sudo apachectl restart Restart apache on it


The apache2 directory structure under Ubuntu###

  1. The default site is /var/www/
  2. The configuration file is in /etc/apache2/
  3. The log is in /var/log/apache/
  4. The startup script is /etc/init.d/apache2

Folders and files under etc/apache2####

apache2.conf: Apache's main configuration file, including global configuration.
envvars: Apache2 environment variable settings.
ports.conf: Configure the ports that Apache listens to.
mods-available: This directory contains modules and module configuration files. Not all modules have configuration files.
mods-enabled: Holds links to files in the /etc/apache2/mods-available directory. When there is a module file and its configuration file in this directory, the module will take effect after Apache restarts.
sites-available: This directory contains configuration files for Apache virtual hosts. Virtual hosts allow Apache to configure multiple sites and configure different parameters for each site. In the following configuration, http redirection of port 80 will be configured as https of 443.
sites-enabled: Holds links to files in the /etc/apache2/sites-available directory. When Apache restarts, the sites contained in this directory will be activated.

via https://blog.csdn.net/WsXOM853BD45Fm92B0L/article/details/80115863

Recommended Posts

How to install https certificate (ubuntu+apache2)
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install Memcached on CentOS 8
How to install VirtualBox on Ubuntu 20.04
How to install R on CentOS 8
How to install Elasticsearch on Ubuntu 20.04
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install TensorFlow on CentOS 8
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install PHP7.4 in CentOS
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Vagrant on Ubuntu 20.04
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install GCC on CentOS 8
How to install mysql in Ubuntu 14.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install Yarn on CentOS 8
How to install MemSQL on Ubuntu 14.04
How to install Nginx on CentOS 8
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Python 3.8 on Ubuntu 18.04
How to install Webmin on CentOS 8
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to install Ruby on CentOS 8