• 本帖最后由 behch 于 2016-6-15 20:52 编辑 *

Apache怎么设置SSL证书呢?

ServerAdmin [webmaster@example.com](mailto:webmaster@example.com)
php_admin_value open_basedir "/home/wwwroot/default/diguo:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/home/wwwroot/default/diguo"
ServerName www.hostloc.com
#ErrorLog "/home/wwwlogs/-error_log"
#CustomLog "/home/wwwlogs/-access_log" combined

SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php

下面是nginx的设置方法

server
{
listen 443;
server_name www.hostloc.com;
access_log off;
index index.html index.htm index.php;
include /usr/local/nginx/conf/rewrite/none.conf;
root /data/wwwroot/diguos;

ssl on;
ssl_certificate /usr/local/nginx/conf/ssl.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl.key;

location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}

server
{
listen 80;
server_name www.hostloc.com;
rewrite ^/(.*) https://www.hostloc.com/$1 permanent;
}