乌秋博客
梦想在左,生活在右。   

微信小程序服务器配置
  虽说现在腾讯云推出了小程序服务器套餐,并且抛出首月3元的诱惑,但是我的程序和数据都在阿里云,搬家自是不易还不如自己动手丰衣足食顺便跟大家分享心得。

一、配置nginx
到阿里云免费申请一个ssl证书,审核通过后下载证书文件到服务器,修改nginx.conf添加如下内容:
server {
 listen 443;
 server_name localhost;
 ssl on;
 root html;
 index index.html index.htm;
 ssl_certificate cert/214172421390554.pem;
 ssl_certificate_key cert/214172421390554.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;
 ssl_prefer_server_ciphers on;
 location / {
  root html;
  index index.html index.htm;
 }
}


二、升级openssl
# openssl version -a
如果openssl版本低于1.0,升级。
# wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
# tar xzf openssl-1.0.2l.tar.gz
# cd openssl-1.0.2l
# ./config --prefix=/usr/local/openssl
# make
# make install

# mv /usr/bin/openssl \
/usr/bin/openssl.OFF
# mv /usr/include/openssl \
/usr/include/openssl.OFF
# ln -s \
/usr/local/openssl/bin/openssl \
/usr/bin/openssl
# ln -s \
/usr/local/openssl/include/openssl \
/usr/include/openssl
# echo "/usr/local/openssl/lib"\
>>/etc/ld.so.conf
# ldconfig -v


三、安装zlib
# wget http://www.zlib.net/zlib-1.2.11.tar.gz
# tar xzf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure --prefix=/usr/local/zlib
# make
# make install


四、安装pcre
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.bz2
# tar xjf pcre-8.39.tar.bz2
# cd pcre-8.39
# ./configure --prefix=/usr/local/pcre
# make
# make install


五、重新编译nginx
# wget http://nginx.org/download/nginx-1.12.0.tar.gz
# ./configure \
--user=nginx \
--group=nginx \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_ssl_module \
--with-openssl=/data/src/openssl-1.0.2l \
--with-pcre=/data/src/pcre-8.39 \
--with-zlib=/data/src/zlib-1.2.11 \
--with-threads \
--http-log-path=/var/log/nginx/access.log \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/tmp/client_temp \
--http-proxy-temp-path=/tmp/proxy_temp \
--http-fastcgi-temp-path=/tmp/fcgi_temp \
--http-uwsgi-temp-path=/tmp/uwsgi_temp \
--http-scgi-temp-path=/tmp/scgi_temp
# make
# make install


六、测试
检测网址:https://cryptoreport.websecurity.symantec.com/checker/views/certCheck.jsp?spm=5176.7748023.2.3.QmKEsY&file=certCheck.jsp
posted at 17/06/22 18:06 | 开发手记 - 工作日志 | 浏览(72) | 引用 | 评论

 Track this back : http://www.koven.org/rserver.php?mode=tb&sl=484
  name   password   homepage
隐藏评论(只有管理员可见)   ?  


      << prev    1  ...  383  384  385  386  387  388  389  390  391    next >>