$ sudo apt-get install apache2
然后访问http://hostname/确认安装成功.
让apache支持ssl:
$ sudo apache2-ssl-certificate
$ cd /etc/apache2/
$ sudo cp sites-available/default sites-available/ssl
$ sudo ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/000-ssl
$ sudo vi sites-available/ssl
将前面4行:
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
替换成:
NameVirtualHost *:443
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLEngine On
$ sudo vi /etc/apache2/ports.conf
在 Listen 80 下面添加一行:
Listen 443
重启apache:
$ sudo /etc/init.d/apache2 restart
然后访问https://hostname/确认设置成功.
转载于:https://www.cnblogs.com/timke/archive/2007/11/11/955606.html