转自:
http://bbs.chinaunix.net/thread-711979-1-1.html
一、简介 目的:构建小型WEB站,具备SSL,解析PHP脚本(适用嵌入式环境)。 作者:sundy 2006-3-6 E_MAIL:hysundy@163.com 二、环境资源 redhat 8 mini_httpd_1.19 b修改版 php.4.4.2 三、步骤说明 ------------------------------------------------------------- a.安装 php (简介 类似文章很多了 ) 解压 php.4.4.2 #cd php.4.4.2/ #./configure --prefix=/usr/local/php # make install 安装完成后把/usr/local/src/php-4.4.2/php.ini-dist复制到/usr/local/php/lib/,并重命名为php.ini -------------------------------------------------------------- -------------------------------------------------------------- b.安装 mini_httpd-1.19 解压 mini_httpd-1.19bhoc.tar.gz #cd mini_httpd-1.19bhoc #vi Makefile 修改后如下:
修改说明: 编译支持SSL,采用redhat8 自带SSL /usr/share/ssl。 SSL_TREE = /usr/share/ssl SSL_DEFS = -DUSE_SSL SSL_INC = -I${SSL_TREE}/include SSL_LIBS = -L${SSL_TREE}/lib -lssl -lcrypto 修改ssl证书有效期为10年, -days 3650 cert: mini_httpd.pem mini_httpd.pem: mini_httpd.cnf openssl req -new -x509 -days 3650 -nodes #make #make install 每次重新编译前需要运行(make clean) -------------------------------------------------------------- 生成SSL证书: #make cert 安提示输入证书信息,即在当前目录下生成证书文件mini_httpd.pem 拷贝该文件到 /etc #cp ./mini_httpd.pem /etc -------------------------------------------------------------- 修改建立mini_httpd.conf 配置文件
拷贝该配置文件到 /etc目录 #cp ./mini_httpd.conf /etc -------------------------------------------------------------- 建立php 测试脚本test.php 如下:
拷贝该脚本到,web 数据目录 #cp ./test.php /usr/local/www 更改文件为可执行! #chmod +x /usr/local/www/test.php -------------------------------------------------------------- 配置WEB服务网卡IP #ifconfig eth0 192.168.1.1 up 启动mini_httpd #mini_httpd -C /etc/mini_httpd.conf 客户端测试URL https://192.168.1.1/test.php |