当前位置:操作系统 > Unix/Linux >>

archlinux上安装httpd+php+mysql+openssl

在arch linux安装则是非常的容易,只要执行:

  # pacman -Sy apache php mysql openssl

  根据提示选择输入Y即可安装!

  1.修改apache配置文件

  默认的情况,apache是不支持PHP的,请修改配置文件:

  vi /etc/httpd/conf/httpd.conf

  把

  #LoadModule php5_module lib/apache/libphp5.so

  的#去掉:

  LoadModule php5_module lib/apache/libphp5.so

  因为apache默认的情况没有启动ssl,所以要:

  1) 修改/etc/conf.d/httpd

  把: HTTPD_USE_SSL="no"

  改成:HTTPD_USE_SSL="yes"

  2) 生成CA的key

  # cd /etc/httpd/conf

  # openssl req -new -x509 -newkey rsa:1024 -days 3650 -keyout server.key -out server.crt

  # openssl rsa -in server.key -out server.key

  3) 修改/etc/httpd/conf/ssl.conf

  SSLCertificateFile /etc/httpd/conf/server.crt

  SSLCertificateKeyFile /etc/httpd/conf/server.key

  最后启动apache

  /etc/rc.d/httpd start

  2.启动mysql

  /etc/rc.d/mysqld start

  最后你可以打开WEB测试一下:

  简单吧?

  下面是我的ssl文件:

  Listen 443

  AddType application/x-x509-ca-cert .crt

  AddType application/x-pkcs7-crl .crl

  SSLPassPhraseDialog builtin

  SSLSessionCache dbm:/var/log/httpd/ssl_scache

  SSLSessionCacheTimeout 300

  SSLMutex file:/var/log/httpd/ssl_mutex

  SSLRandomSeed startup builtin

  SSLRandomSeed connect builtin

  # 这里我写直接的IP地址

  DocumentRoot "/data/blog"

  ServerName blog.ourlinux.net:443

  ServerAdmin bixuan@ourlinux.net

  ErrorLog /var/log/httpd/blog.ourlinux.net_443_error_log

  TransferLog /var/log/httpd/blog.ourlinux.net_443_access_log

  SSLEngine on

  SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

  SSLCertificateFile /etc/httpd/conf/server.crt

  SSLCertificateKeyFile /etc/httpd/conf/server.key

  SSLCACertificatePath /etc/httpd/conf/ssl_blog.ourlinux.net

  SSLCACertificateFile /etc/httpd/conf/server.crt

  SSLVerifyClient require

  

  SSLVerifyDepth 1

  SSLOptions +StdEnvVars

  SSLOptions +StdEnvVars

  SetEnvIf User-Agent ".*MSIE.*"

  nokeepalive ssl-unclean-shutdown

  downgrade-1.0 force-response-1.0

  CustomLog /var/log/httpd/ssl_request_log

  "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"

  补充:因为我这里的ssl里有虚拟主机,所以务必在:httpd.conf里加上:

  NameVirtualHost ip:443

  这句!

  每次修改配置文件,请记着:reload

  # /etc/rc.d/httpd reload
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,