汇总php apache https设置

 

 

linux下apache+php配置

2007-03-2522:36:27

标签:php linux Apache 配置

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://loveme23.blog.51cto.com/7891/21514

  用了一天的时间总算配置出来了,呵呵,是不是太笨了!好了下面我就把配置步骤和需要注意的地方写下来:
首先下载apache_1.3.20.tar.gz和php-4.4.6.tar.gz(听说老版本比较稳定,所以选择老版本试验)
然后移动到/usr/local/目录
mv /home/loveme23/apache_1.3.20.tar.gz /usr/local/
mv /home/loveme23/php-4.4.6.tar.gz /usr/local/
接下来解压:
tar -zxvf php-4.4.6.tar.gz
tar -zxvf apache_1.3.20.tar.gz
下来就比较重要了,先编译安装apache:
./configure --prefix=/usr/local/apache --enable-module=so
make;make install
然后再编译安装php:
./configure --prefix=/usr/local/php --with-apxs=/usr/local/apache/bin/apxs--with-config-file-path=/usr/local/lib
make;make install
OK,现在已经完成50%了,下来就是修改httpd.conf和php.ini文件了
首先我们用命令:
cp /usr/local/php-4.4.6/php.ini-dist /usr/local/lib/php.ini
vi /usr/local/lib/php.ini
修改下面的内容为On
register-golbals = On
然后修改httpd.conf文件
vi /usr/local/apache/conf/httpd.conf
修改为下面的内容:
#将ServerAdmin q3boy@younet.com一行改为您的邮箱地址

#DocumentRoot"/home/httpd/html/" 此处为html文件主目录

# 同上

#OptionsFollowSymLinks MultiViews 为安全起见,去掉"Indexes"

#
# DirectoryIndex default.php default.phtml default.php3 default.htmldefault.htm
#
#设置apache的默认文件名次序

#AddTypeapplication/x-httpd-php .php .phtml .php3 .inc
#AddType application/x-httpd-php-source .phps
#设置php文件后缀

OK!现在已经完成98%了,下面启动apache服务

/usr/local/apache/bin/apachectlstart
自己制作一个test.php文件放到主目录中测试apache
<?
  phpinfo();
?>
看到了吧! 如果成功的话,会显示你的phpinfo界面

 

 

注意:

如果出现

[root@localhostphp-5.2.17]# /usr/local/apache/bin/apachectl start

Syntax error on line 232 of/usr/local/apache/conf/httpd.conf:

Cannot load/usr/local/apache/modules/libphp5.so into server:/usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc:Permission denied

则使用如下命令:

[root@localhost php-5.2.17]# chcon -ttexrel_shlib_t /usr/local/apache/modules/libphp5.so

 

Windows Apache HTTPS配置

分类: 其它 2009-09-03 15:49 472人阅读 评论(0) 收藏举报

Windows Apache HTTPS配置

创建下面3个目录:

C:/Program Files/Apache Group/Apache2/conf/ssl
C:/Program Files/Apache Group/Apache2/conf/ssl.key
C:/Program Files/Apache Group/Apache2/conf/ssl.crt

这里假设apache安装目录是

C:/Program Files/Apache Group/Apache2/

下载
http://tud.at/programm/openssl.cnf

C:/Program Files/ApacheGroup/Apache2/conf/ssl

目录下

进入命令行,输入下面的命令:
# 注:以下用到的密码都是1234

openssl req -config openssl.cnf -new -outserver.csr
  Country Name (2 letter code) []:CN
  State or Province Name (full name) []:Shanghai
  Locality Name (eg, city) []:Shanghai
  Organization Name (eg, company) []:Company name
  Organizational Unit Name (eg, section) []:IT
  Common Name (eg, your websites domain name) []:www.test.com
  Email Address []:webmaster@test.com

  Please enter the following 'extra' attributes to be sent with yourcertificate request  A challenge password []:1234

openssl rsa -in privkey.pem -out server.key

openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
openssl x509 -in server.crt -out server.der.crt -outform DER

server.crt 移动到

C:/Program Files/ApacheGroup/Apache2/conf/ssl.crt


server.key 移动到

C:/Program Files/ApacheGroup/Apache2/conf/ssl.key

C:/Program Files/ApacheGroup/Apache2/apache.exe -D SSL
cd C:/Program Files/Apache Group/Apache2/bin
Apache.exe -k install
Apache.exe -k config -D SSL
Apache.exe -k start

FreeBSD Apache HTTPS配置

1. 设置启动

#echo 'apache2_enable="YES"'>> /etc/rc.conf
#echo ‘apache22ssl_enable="YES"' >> /etc/rc.conf

2. 编辑

/usr/local/etc/apache22/httpd.conf

在最后边加上支持:

Include etc/apache22/extra/httpd-ssl.conf

然后编辑:

/usr/local/etc/apache22/extra/httpd-ssl.conf

修改虚拟机路径:

<VirtualHost _default_:443>
#   General setup for the virtual host
DocumentRoot "/usr/local/www/test"
ServerName www.test.com:443
ServerAdmin test@test.com
ErrorLog "/var/log/httpd-error.log"
TransferLog "/var/log/httpd-access.log"

和以下两个位置为你存放证书路径:

SSLCertificateFile"/usr/local/etc/apache22/ssl.key/server.crt"
SSLCertificateKeyFile "/usr/local/etc/apache22/ssl.key/server.key"

3. 配置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/apache22/ssl.key
#chmod 0700 /usr/local/etc/apache22/ssl.crt
#cp ~/server.key /usr/local/etc/apache22/ssl.key/
#cp ~/server.crt /usr/local/etc/apache22/ssl.crt/
#chmod 0400 /usr/local/etc/apache22/ssl.key/server.key
#chmod 0400 /usr/local/etc/apache22/ssl.crt/server.crt

4. 启动服务器,设置完成。访问服务器时输入:https://域名(或IP),浏览器会弹出安装服务器证明书的窗口。说明服务器已经支持SSL了


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值