1、安装APACHE2
#cd /usr/ports/www/apache22/
#make install clean
2、设置启动
#echo 'apache2_enable="YES"' >> /etc/rc.conf
#echo 'apache2_flags="-DSSL"' >> /etc/rc.conf
3、安装MySQL
#cd /usr/ports/databases/mysql50-server/
#make WITH_CHARSET=GBK WITH_XCHARSET=all install clean
#echo 'mysql_enable="YES"' >> /etc/rc.conf
4、安装PHP
#cd /usr/ports/lang/php5
#make install clean
#cd /usr/ports/lang/php5-extensions/
#make install clean
5、设置httpd.conf
a、加入php支持
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
b、更改虚拟域设置
ServerName localhost.org
ServerAlias
ServerAdmin admin@localhost
DocumentRoot /path/to/website/files
SSLEngine on
SSLCertificateFile /usr/local/etc/apache/ssl.crt/server2.crt
SSLCertificateKeyFile
/usr/local/etc/apache/ssl.key/server2.key
6、配置mod_ssl
#openssl genrsa -des3 -out server.key 1024
#openssl rsa -in server.key -out server.key
(*从密钥中删除密码,以避免系统启动时被询问口令)
#openssl req -new -key server.key -out
server.csr
#openssl x509 -req -days 365 -in server.csr -signkey server.key
-out server.crt
#mkdir /usr/local/etc/apache22ssl.key
#mkdir /usr/local/etc/apache22ssl.crt
#chmod 0700 /usr/local/etc/apache22ssl.key
#chmod 0700 /usr/local/etc/apache22ssl.crt
#cp ~/server.key /usr/local/etc/apache/ssl.key/
#cp ~/server.crt /usr/local/etc/apache/ssl.crt/
#chmod 0400 /usr/local/etc/apache2/ssl.key/server.key
#chmod 0400 /usr/local/etc/apache2/ssl.crt/server.crt
7启动服务器,设置完成。访问服务器时输入:https://域名(或IP),浏览器会弹出安装服务器证明书的窗口。说明服务器已经支持SSL了。
阅读(663) | 评论(0) | 转发(0) |