第一步:
首先下载阿里云的ssl证书
第二步:
在/etc/nginx/目录下创建cert目录,然后把两个pem和key文件放入其中
第三步:
在sites-avalibale/default中写相关的配置,参考阿里云的官网,这里有一份如下:
server {
listen 80;
server_name xxx.sunzhongwei.com;
return 301 https://xxx.sunzhongwei.com$request_uri;
}
server {
listen 443;
server_name xxx.sunzhongwei.com;
root /xxx/public;
index index.html index.htm index.php;
ssl on;
ssl_certificate /xxx/storage/cert/xxx.sunzhongwei.com.pem;
ssl_certificate_key /xxx/storage/cert/xxx.sunzhongwei.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/xxx-access.log access;
error_log /var/log/nginx/xxx-error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
第四步:
验证nginx启动页面是不是加锁的,如果加锁的就成功了
第五步:
把opencart里面的upload文件夹里面的内容复制过去,这里有一个点就是要把这个文件夹的所有者改成www-data,用如下语句
chown -R www-data:www-data /var/www/html/xxx
然后官网说把config-dist.php 改成config.php 但是改完之后的所有者是root,所以还要用上面的语句把config.php这个文件的所有者改成www-data
第六步:
按照提示安装就可以了。